From cbecc11107be7944ed86f575e3b8527aafd7131a Mon Sep 17 00:00:00 2001 From: marzban-dev Date: Tue, 14 Jan 2025 20:41:34 +0330 Subject: [PATCH 01/16] Updated --- frontend/composables/useAuth.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/frontend/composables/useAuth.ts b/frontend/composables/useAuth.ts index 831ad40..2fa8493 100644 --- a/frontend/composables/useAuth.ts +++ b/frontend/composables/useAuth.ts @@ -1,5 +1,3 @@ -import useGetAccount from "~/composables/api/account/useGetAccount"; - export const useAuth = () => { // state @@ -17,14 +15,6 @@ export const useAuth = () => { if (reload) window.location.reload(); }; - // watch - - watch(() => token.value, (newValue) => { - token.value = newValue; - }, { - immediate: true - }); - return { token, updateToken, logout }; }; \ No newline at end of file From 800b848f1707bd00db8de13cc8a10678f0a4875d Mon Sep 17 00:00:00 2001 From: marzban-dev Date: Tue, 14 Jan 2025 20:42:20 +0330 Subject: [PATCH 02/16] Updated --- frontend/nuxt.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/nuxt.config.ts b/frontend/nuxt.config.ts index 8978648..a613368 100644 --- a/frontend/nuxt.config.ts +++ b/frontend/nuxt.config.ts @@ -1,7 +1,7 @@ // https://nuxt.com/docs/api/configuration/nuxt-config export default defineNuxtConfig({ compatibilityDate: "2024-11-01", - ssr: false, + ssr: true, devtools: { enabled: false }, css: ["~/assets/css/tailwind.css", "swiper/css"], From 74137bb12c2754dc6c317911de94f69c86ec63ba Mon Sep 17 00:00:00 2001 From: Mamalizz Date: Tue, 14 Jan 2025 20:46:52 +0330 Subject: [PATCH 03/16] fixed composable path error --- frontend/components/global/Header.vue | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/frontend/components/global/Header.vue b/frontend/components/global/Header.vue index 7ff84ac..07cda45 100644 --- a/frontend/components/global/Header.vue +++ b/frontend/components/global/Header.vue @@ -1,8 +1,8 @@ @@ -45,16 +45,15 @@ const nav_links = ref([
-
+
- +
-
- KIR -
+
KIR
From 1cbaa53b4ad08143fb0c5123476311dbc7e4c42a Mon Sep 17 00:00:00 2001 From: marzban-dev Date: Tue, 14 Jan 2025 21:02:27 +0330 Subject: [PATCH 13/16] 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 From 318b07fc3f01bf6718712677c6bb54c8dd7628a1 Mon Sep 17 00:00:00 2001 From: marzban-dev Date: Tue, 14 Jan 2025 21:03:27 +0330 Subject: [PATCH 14/16] Updated --- frontend/pages/signin/index.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/pages/signin/index.vue b/frontend/pages/signin/index.vue index 414d858..b201195 100644 --- a/frontend/pages/signin/index.vue +++ b/frontend/pages/signin/index.vue @@ -5,10 +5,12 @@ import { helpers, required } from "@vuelidate/validators"; import { useVuelidate } from "@vuelidate/core"; import useOtp from "~/composables/api/auth/useOtp"; -import { useTimer } from "~/composables/useTimer"; import useSignIn from "~/composables/api/auth/useSignIn"; import { definePageMeta } from "#imports"; import useGetAccount from "~/composables/api/account/useGetAccount"; +import { useAuth } from "~/composables/api/auth/useAuth"; +import { useToast } from "~/composables/global/useToast"; +import { useTimer } from "~/composables/global/useTimer"; // types From af9736f3e773b83f23c686d33257a1f5f45db8ec Mon Sep 17 00:00:00 2001 From: marzban-dev Date: Tue, 14 Jan 2025 21:03:34 +0330 Subject: [PATCH 15/16] Updated --- frontend/composables/api/account/useGetAccount.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/composables/api/account/useGetAccount.ts b/frontend/composables/api/account/useGetAccount.ts index a7d2bbb..4366999 100644 --- a/frontend/composables/api/account/useGetAccount.ts +++ b/frontend/composables/api/account/useGetAccount.ts @@ -12,6 +12,7 @@ const useGetAccount = () => { // state const { $axios: axios } = useNuxtApp(); + const { token } = useAuth(); // methods @@ -21,6 +22,7 @@ const useGetAccount = () => { }; return useQuery({ + enabled: !!token.value, queryKey: [QUERY_KEYS.account], queryFn: () => handleGetAccount() }); From 2ad1f38b8ae6d56498bbc7eb215afb805c841e7a Mon Sep 17 00:00:00 2001 From: marzban-dev Date: Tue, 14 Jan 2025 21:18:42 +0330 Subject: [PATCH 16/16] Import useAuth --- frontend/composables/api/account/useGetAccount.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/composables/api/account/useGetAccount.ts b/frontend/composables/api/account/useGetAccount.ts index 4366999..7c2ed83 100644 --- a/frontend/composables/api/account/useGetAccount.ts +++ b/frontend/composables/api/account/useGetAccount.ts @@ -2,6 +2,7 @@ import { useQuery } from "@tanstack/vue-query"; import { API_ENDPOINTS, QUERY_KEYS } from "~/constants"; +import { useAuth } from "~/composables/api/auth/useAuth"; // types