Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

Remove localstorage token (#426)

Dave Earley765ba5f030b0
diff --git a/frontend/src/api/client.ts b/frontend/src/api/client.ts
index eae8e0b76..e5f489c56 100644
--- a/frontend/src/api/client.ts
+++ b/frontend/src/api/client.ts
@@ -1,5 +1,4 @@
import axios from "axios";
-import {setAuthToken} from "../utilites/apiClient.ts";
import {isSsr} from "../utilites/helpers.ts";
import {getConfig} from "../utilites/config.ts";
@@ -34,20 +33,8 @@ export const api = axios.create({
withCredentials: true,
});
-const existingToken = typeof window !== "undefined" ? window.localStorage.getItem('token') : undefined;
-if (existingToken) {
- setAuthToken(existingToken);
-}
-
api.interceptors.response.use(
- (response) => {
- const token = response?.data?.token || response?.headers["x-auth-token"];
- if (token) {
- window?.localStorage?.setItem('token', token);
- setAuthToken(token);
- }
- return response;
- },
+ (response) => response,
(error) => {
const { status } = error.response;
const currentPath = window?.location.pathname;
diff --git a/frontend/src/api/public-client.ts b/frontend/src/api/public-client.ts
index 9b31efda2..05c44fed0 100644
--- a/frontend/src/api/public-client.ts
+++ b/frontend/src/api/public-client.ts
@@ -6,12 +6,6 @@ export const publicApi = axios.create({
withCredentials: true,
});
-const existingToken = typeof window !== "undefined" ? window?.localStorage?.getItem('token') : undefined;
-
-if (existingToken) {
- publicApi.defaults.headers.common['Authorization'] = `Bearer ${existingToken}`;
-}
-
publicApi.interceptors.request.use((config) => {
const baseUrl = isSsr()
? getConfig('VITE_API_URL_SERVER')