Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
C
chatGLM
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘坚-丰林-DEV
chatGLM
Commits
5958eb98
Commit
5958eb98
authored
Apr 15, 2023
by
Ylg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete interceptors
parent
5dfd8de6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
16 deletions
+20
-16
index.tsx
src/pages/Chat/index.tsx
+1
-1
api.ts
src/services/chatGLM/api.ts
+19
-15
No files found.
src/pages/Chat/index.tsx
View file @
5958eb98
...
@@ -35,7 +35,7 @@ const Chat: React.FC = () => {
...
@@ -35,7 +35,7 @@ const Chat: React.FC = () => {
const
[
selectSiderTabs
,
setSelectSiderTabs
]
=
useState
(
''
);
const
[
selectSiderTabs
,
setSelectSiderTabs
]
=
useState
(
''
);
const
[
open
,
setOpen
]
=
useState
(
false
);
const
[
open
,
setOpen
]
=
useState
(
false
);
const
tabShow
=
showSider
&&
isMobile
;
const
tabShow
=
showSider
;
useEffect
(()
=>
{
useEffect
(()
=>
{
let
token
=
''
;
let
token
=
''
;
...
...
src/services/chatGLM/api.ts
View file @
5958eb98
...
@@ -5,25 +5,29 @@ interface ILoginParams {
...
@@ -5,25 +5,29 @@ interface ILoginParams {
password
:
string
;
password
:
string
;
}
}
request
.
interceptors
.
request
.
use
((
url
,
options
)
=>
{
//
request.interceptors.request.use((url, options) => {
let
{
token
}
=
JSON
.
parse
(
localStorage
.
getItem
(
'user'
)
||
''
);
//
let { token } = JSON.parse(localStorage.getItem('user') || '');
if
(
null
===
token
)
{
//
if (null === token) {
token
=
''
;
//
token = '';
}
//
}
const
authHeader
=
{
//
const authHeader = {
Authorization
:
`Bearer
${
token
}
`
,
//
Authorization: `Bearer ${token}`,
'Content-Type'
:
'application/json'
,
//
'Content-Type': 'application/json',
'__tenant'
:
'3a0a90fe-9a0d-70f4-200d-a80a41fb6195'
// 用户id
//
'__tenant': '3a0a90fe-9a0d-70f4-200d-a80a41fb6195' // 用户id
};
//
};
return
{
//
return {
url
:
url
,
//
url: url,
options
:
{
...
options
,
interceptors
:
true
,
headers
:
authHeader
},
//
options: { ...options, interceptors: true, headers: authHeader },
};
//
};
});
//
});
export
function
loginChatGLM
(
options
:
ILoginParams
)
{
export
function
loginChatGLM
(
options
:
ILoginParams
)
{
return
request
(
'https://glm-mangement-api.baibaomen.com/api/app/account/login'
,
{
return
request
(
'https://glm-mangement-api.baibaomen.com/api/app/account/login'
,
{
method
:
'POST'
,
method
:
'POST'
,
headers
:
{
'Content-Type'
:
'application/json'
,
'__tenant'
:
'3a0a90fe-9a0d-70f4-200d-a80a41fb6195'
},
data
:
options
data
:
options
})
})
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment