From 1cbaa53b4ad08143fb0c5123476311dbc7e4c42a Mon Sep 17 00:00:00 2001 From: marzban-dev Date: Tue, 14 Jan 2025 21:02:27 +0330 Subject: [PATCH] Updated --- frontend/plugins/axios.ts | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/frontend/plugins/axios.ts b/frontend/plugins/axios.ts index d530e63..2a63f37 100644 --- a/frontend/plugins/axios.ts +++ b/frontend/plugins/axios.ts @@ -4,7 +4,7 @@ import { API_ENDPOINTS } from "~/constants"; export default defineNuxtPlugin(() => { const config = useRuntimeConfig(); - const { logout, token } = useAuth(); + const { token } = useAuth(); const axios = axiosOriginal.create({ baseURL: config.public.API_BASE_URL, @@ -21,22 +21,21 @@ export default defineNuxtPlugin(() => { return config; }); - axios.interceptors.response.use( - (response) => { - return response; - }, - function (error) { - if (error.status === 401) { - logout(); - } + axios.interceptors.response.use((response) => { + return response; + }, function(error) { - return Promise.reject(error); + if (error.status === 401) { + logout(); } - ); + + return Promise.reject(error); + }); return { provide: { - axios, - }, + axios + } }; -}); + +}); \ No newline at end of file