diff --git a/src/api/interceptor.ts b/src/api/interceptor.ts index ebad100..d0caade 100644 --- a/src/api/interceptor.ts +++ b/src/api/interceptor.ts @@ -5,6 +5,7 @@ import { useUserStore } from '@/store'; import { getToken,getRefreshToken } from '@/utils/auth'; export interface HttpResponse { + message: string; status: number; msg: string; code: number; @@ -42,29 +43,30 @@ axios.interceptors.response.use( // if the custom code is not 20000, it is judged as an error. if (res.code !== 200) { Message.error({ - content: res.msg || 'Error', + content: res.message || 'Error', duration: 5 * 1000, }); - console.log(response.status) - // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired; - if ( - [50008, 50012, 50014,401].includes(res.code) && - response.config.url !== '/api/user/info' - ) { - 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(); + // console.log(response.status) + // // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired; + // if ( + // [50008, 50012, 50014,401].includes(res.code) && + // response.config.url !== '/api/user/info' + // ) { + // 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(); - }, - }); - } - return Promise.reject(new Error(res.msg || 'Error')); + // await userStore.logout(); + // window.location.reload(); + // }, + // }); + // } + // return Promise.reject(new Error(res.msg || 'Error')); + return res } return res; }, diff --git a/src/views/withdraw/index.vue b/src/views/withdraw/index.vue index b452181..169b039 100644 --- a/src/views/withdraw/index.vue +++ b/src/views/withdraw/index.vue @@ -180,11 +180,12 @@ const handleBlock = async(record:any) => { const res = await pushMoney(record); if(res.code === 200 ){ reset(); - getAll(); - Message.success('操作成功') + + Message.success(res.data.message) }else{ - Message.error(res.msg) + Message.success(res.data.message) } + getAll(); }; //不同意提现 @@ -193,9 +194,11 @@ const handleNotBlock = async(record:any) => { const res = await pushMoney(record); if(res.code === 200 ){ reset(); - getAll(); - Message.success('操作成功') + + Message.success(res.data.message) } + Message.error(res.data.message) + getAll(); }; //显示合计