修复前端401不重新登录问题
This commit is contained in:
parent
448530bc29
commit
766e83f67e
|
@ -45,7 +45,7 @@ axios.interceptors.response.use(
|
||||||
content: res.msg || 'Error',
|
content: res.msg || 'Error',
|
||||||
duration: 5 * 1000,
|
duration: 5 * 1000,
|
||||||
});
|
});
|
||||||
console.log(res)
|
console.log(response.status)
|
||||||
// 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
|
// 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
|
||||||
if (
|
if (
|
||||||
[50008, 50012, 50014,401].includes(res.code) &&
|
[50008, 50012, 50014,401].includes(res.code) &&
|
||||||
|
@ -69,6 +69,21 @@ axios.interceptors.response.use(
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
|
if(error.response.status==401){
|
||||||
|
{
|
||||||
|
Modal.error({
|
||||||
|
title: 'Confirm logout',
|
||||||
|
content:
|
||||||
|
'You have been logged out, you can cancel to stay on this page, or log in again',
|
||||||
|
okText: 'Re-Login',
|
||||||
|
async onOk() {
|
||||||
|
const userStore = useUserStore();
|
||||||
|
await userStore.logout();
|
||||||
|
window.location.reload();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Message.error({
|
Message.error({
|
||||||
content: error.msg || 'Request Error',
|
content: error.msg || 'Request Error',
|
||||||
duration: 5 * 1000,
|
duration: 5 * 1000,
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<h2 style="text-align: center;">100积分</h2>
|
<h2 style="text-align: center;">100积分</h2>
|
||||||
<a-form :model="form" auto-label-width @submit="handleSubmit">
|
<a-form :model="form" auto-label-width @submit="handleSubmit">
|
||||||
<a-form-item field="BDT" label="BDT">
|
<a-form-item field="BDT" label="BDT">
|
||||||
<a-input v-model="form.USDT" placeholder="请输入对应的BDT汇率" />
|
<a-input v-model="form.BDT" placeholder="请输入对应的BDT汇率" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item field="NGN" label="NGN">
|
<a-form-item field="NGN" label="NGN">
|
||||||
<a-input v-model="form.NGN" placeholder="请输入对应的NGN汇率" />
|
<a-input v-model="form.NGN" placeholder="请输入对应的NGN汇率" />
|
||||||
|
@ -44,7 +44,7 @@ import { ref, onMounted,reactive } from 'vue';
|
||||||
import { IconFolderAdd } from '@arco-design/web-vue/es/icon';
|
import { IconFolderAdd } from '@arco-design/web-vue/es/icon';
|
||||||
import carouselitem from './components/carouselitem.vue';
|
import carouselitem from './components/carouselitem.vue';
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
USDT:10,
|
BDT:10,
|
||||||
NGN:10,
|
NGN:10,
|
||||||
TRX:10,
|
TRX:10,
|
||||||
INR:10,
|
INR:10,
|
||||||
|
|
Loading…
Reference in New Issue