feat(@vben/web-antd): 优化登录失败问题
- 增加登录失败刷新token
This commit is contained in:
parent
09eb944612
commit
3781e6cd47
@ -77,6 +77,12 @@ export const useAuthStore = defineStore('auth', () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error: any) {
|
||||||
|
if (error.code === 401) {
|
||||||
|
const { csrf } = await getUserInfoApi(); // 获取新的 token
|
||||||
|
setToken(csrf.token); // 更新 CSRF token
|
||||||
|
accessStore.setAccessToken(csrf.token);
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
loginLoading.value = false;
|
loginLoading.value = false;
|
||||||
}
|
}
|
||||||
|
@ -238,8 +238,8 @@ const startFetching = async () => {
|
|||||||
}
|
}
|
||||||
conversationId.value = res.conversationId;
|
conversationId.value = res.conversationId;
|
||||||
const { filename, url } = extractDocxInfo(res.answer);
|
const { filename, url } = extractDocxInfo(res.answer);
|
||||||
if (res.messageFiles) {
|
if (res.answer) {
|
||||||
const { id, url } = res.messageFiles[0];
|
// const { id, url } = res.messageFiles[0];
|
||||||
resultItems.value.push({
|
resultItems.value.push({
|
||||||
key: resultItems.value.length + 1,
|
key: resultItems.value.length + 1,
|
||||||
role: 'ai',
|
role: 'ai',
|
||||||
@ -265,7 +265,7 @@ const startFetching = async () => {
|
|||||||
onClick: () => {
|
onClick: () => {
|
||||||
const link = document.createElement('a');
|
const link = document.createElement('a');
|
||||||
link.href = url;
|
link.href = url;
|
||||||
link.download = id;
|
link.download = filename;
|
||||||
document.body.append(link);
|
document.body.append(link);
|
||||||
link.click();
|
link.click();
|
||||||
link.remove();
|
link.remove();
|
||||||
|
Loading…
Reference in New Issue
Block a user