File tree Expand file tree Collapse file tree 2 files changed +1
-20
lines changed
Expand file tree Collapse file tree 2 files changed +1
-20
lines changed Original file line number Diff line number Diff line change 11import axios from "axios" ;
2- import { setAuthToken } from "../utilites/apiClient.ts" ;
32import { isSsr } from "../utilites/helpers.ts" ;
43import { getConfig } from "../utilites/config.ts" ;
54
@@ -34,20 +33,8 @@ export const api = axios.create({
3433 withCredentials : true ,
3534} ) ;
3635
37- const existingToken = typeof window !== "undefined" ? window . localStorage . getItem ( 'token' ) : undefined ;
38- if ( existingToken ) {
39- setAuthToken ( existingToken ) ;
40- }
41-
4236api . interceptors . response . use (
43- ( response ) => {
44- const token = response ?. data ?. token || response ?. headers [ "x-auth-token" ] ;
45- if ( token ) {
46- window ?. localStorage ?. setItem ( 'token' , token ) ;
47- setAuthToken ( token ) ;
48- }
49- return response ;
50- } ,
37+ ( response ) => response ,
5138 ( error ) => {
5239 const { status } = error . response ;
5340 const currentPath = window ?. location . pathname ;
Original file line number Diff line number Diff line change @@ -6,12 +6,6 @@ export const publicApi = axios.create({
66 withCredentials : true ,
77} ) ;
88
9- const existingToken = typeof window !== "undefined" ? window ?. localStorage ?. getItem ( 'token' ) : undefined ;
10-
11- if ( existingToken ) {
12- publicApi . defaults . headers . common [ 'Authorization' ] = `Bearer ${ existingToken } ` ;
13- }
14-
159publicApi . interceptors . request . use ( ( config ) => {
1610 const baseUrl = isSsr ( )
1711 ? getConfig ( 'VITE_API_URL_SERVER' )
You can’t perform that action at this time.
0 commit comments