Skip to content

Commit

Permalink
# add handle error
Browse files Browse the repository at this point in the history
  • Loading branch information
czy21 committed Mar 8, 2024
1 parent 37fe7bd commit 46e8a16
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/init/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ function apiAxios(method: Method, url: string, params: any, errorCallBack?: (err
url: url,
data: method === 'POST' || method === 'PUT' ? params : null,
params: method === 'GET' || method === 'DELETE' ? params : null
}).then(res => resolve(res), error => {
}).then(res => resolve(res)).catch(error => {
switch (error?.response.status) {
case 504:
message.error("网络超时")
}
if (errorCallBack) {
errorCallBack(error)
}
}).catch(error => reject(error))
})
})
}

Expand Down

0 comments on commit 46e8a16

Please sign in to comment.