Skip to content

Commit 765ba5f

Browse files
authored
Remove localstorage token (#426)
1 parent d7b2fb4 commit 765ba5f

File tree

2 files changed

+1
-20
lines changed

2 files changed

+1
-20
lines changed

frontend/src/api/client.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import axios from "axios";
2-
import {setAuthToken} from "../utilites/apiClient.ts";
32
import {isSsr} from "../utilites/helpers.ts";
43
import {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-
4236
api.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;

frontend/src/api/public-client.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff 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-
159
publicApi.interceptors.request.use((config) => {
1610
const baseUrl = isSsr()
1711
? getConfig('VITE_API_URL_SERVER')

0 commit comments

Comments
 (0)