Browse Source

bug 修复

lilei 4 years ago
parent
commit
5d85baac70
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/utils/request.js

+ 3 - 0
src/utils/request.js

@@ -15,6 +15,7 @@ const err = (error) => {
   if (error.response) {
   if (error.response) {
     const data = error.response.data
     const data = error.response.data
     if ((error.response.status == 403 || error.response.status == 401) && window.location.pathname != '/user/login') {
     if ((error.response.status == 403 || error.response.status == 401) && window.location.pathname != '/user/login') {
+      notification.destroy()
       notification.error({
       notification.error({
         message: '提示',
         message: '提示',
         description: data.message
         description: data.message
@@ -28,6 +29,7 @@ const err = (error) => {
   }
   }
   // 超时无法访问服务
   // 超时无法访问服务
   if (error.message.indexOf('timeout') >= 0 && window.location.pathname != '/user/login') {
   if (error.message.indexOf('timeout') >= 0 && window.location.pathname != '/user/login') {
+    notification.destroy()
     notification.error({
     notification.error({
       message: '提示',
       message: '提示',
       description: error.message
       description: error.message
@@ -54,6 +56,7 @@ service.interceptors.request.use(config => {
 service.interceptors.response.use((response) => {
 service.interceptors.response.use((response) => {
   console.log(response, 'responseresponseresponse')
   console.log(response, 'responseresponseresponse')
   if (response.data.status == '-1') {
   if (response.data.status == '-1') {
+    notification.destroy()
     notification.error({
     notification.error({
       message: '提示',
       message: '提示',
       description: response.data.message
       description: response.data.message