Skip to content

Commit 2998b2f

Browse files
authored
fix: chat request (#3281)
1 parent 63b783c commit 2998b2f

File tree

2 files changed

+7
-22
lines changed

2 files changed

+7
-22
lines changed

ui/src/request/chat/index.ts

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,8 @@ instance.interceptors.response.use(
4242
(response: any) => {
4343
if (response.data) {
4444
if (response.data.code !== 200 && !(response.data instanceof Blob)) {
45-
if (response.config.url.includes('/application/authentication')) {
46-
return Promise.reject(response.data)
47-
}
48-
if (
49-
!response.config.url.includes('/valid') &&
50-
!response.config.url.includes('/tool/debug')
51-
) {
52-
MsgError(response.data.message)
53-
return Promise.reject(response.data)
54-
}
45+
MsgError(response.data.message)
46+
return Promise.reject(response.data)
5547
}
5648
}
5749
return response
@@ -61,20 +53,14 @@ instance.interceptors.response.use(
6153
MsgError(err.message)
6254
console.error(err)
6355
}
64-
if (err.response?.status === 404) {
65-
if (!err.response.config.url.includes('/application/authentication')) {
66-
router.push('/404 ')
67-
}
68-
}
6956
if (err.response?.status === 401) {
70-
if (
71-
!err.response.config.url.includes('chat/open') &&
72-
!err.response.config.url.includes('application/profile')
73-
) {
74-
router.push({ name: 'login' })
57+
const { chatUser } = useStore()
58+
if (chatUser.accessToken) {
59+
router.push({ name: 'login', params: { accessToken: chatUser.accessToken } })
60+
} else {
61+
router.push('/404 ')
7562
}
7663
}
77-
7864
if (err.response?.status === 403 && !err.response.config.url.includes('chat/open')) {
7965
MsgError(
8066
err.response.data && err.response.data.message ? err.response.data.message : '没有权限访问',

ui/src/router/chat/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ router.beforeEach(
5151
} else {
5252
await chatUser.anonymousAuthentication()
5353
}
54-
5554
if (!chatUser.application) {
5655
await chatUser.applicationProfile()
5756
}

0 commit comments

Comments
 (0)