api
This commit is contained in:
commit
fdcb0e12f4
@ -6,8 +6,7 @@ const getToken = () => {
|
||||
}
|
||||
|
||||
export const api = axios.create({
|
||||
// baseURL: 'https://enaklo-pos-be.altru.id/api/v1',
|
||||
baseURL: 'http://127.0.0.1:4000/api/v1',
|
||||
baseURL: 'https://enaklo-pos-be.altru.id/api/v1',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
@ -32,7 +31,7 @@ api.interceptors.response.use(
|
||||
error => {
|
||||
const status = error.response?.status
|
||||
|
||||
if (status === 401) {
|
||||
if (status === 401 && !currentPath.endsWith('/login')) {
|
||||
localStorage.removeItem('user')
|
||||
localStorage.removeItem('authToken')
|
||||
window.location.href = '/login'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user