refactor code & fixed location
This commit is contained in:
parent
41c1aa8e45
commit
487a6b520e
23 changed files with 566 additions and 145 deletions
|
|
@ -2,7 +2,7 @@ import Axios, { type AxiosRequestConfig, type AxiosResponse } from 'axios'
|
|||
import { getToken } from './auth'
|
||||
|
||||
const http = Axios.create({
|
||||
timeout: 1000000000, // เพิ่มค่า timeout
|
||||
timeout: 30000, // 30 seconds - reasonable timeout for API calls
|
||||
headers: {
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
},
|
||||
|
|
@ -30,6 +30,7 @@ http.interceptors.response.use(
|
|||
// eslint-disable-next-line no-prototype-builtins
|
||||
if (error.hasOwnProperty('response')) {
|
||||
if (error.response.status === 401 || error.response.status === 403) {
|
||||
// TODO: Implement proper logout logic on 401/403
|
||||
// Store.commit("SET_ERROR_MESSAGE", error.response.data.message);
|
||||
// Store.commit("REMOVE_ACCESS_TOKEN")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue