From 0a54b99aefaeb4a0bec2e2a0bbd6d6da7de80d2c Mon Sep 17 00:00:00 2001 From: marzban-dev Date: Thu, 16 Jan 2025 16:01:53 +0330 Subject: [PATCH] Enable chat api when isLoggedIn is true --- frontend/composables/api/chat/useGetChat.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/composables/api/chat/useGetChat.ts b/frontend/composables/api/chat/useGetChat.ts index 32a6da1..8209937 100644 --- a/frontend/composables/api/chat/useGetChat.ts +++ b/frontend/composables/api/chat/useGetChat.ts @@ -2,6 +2,7 @@ import { useInfiniteQuery } from "@tanstack/vue-query"; import { API_ENDPOINTS, QUERY_KEYS } from "~/constants"; +import { useAuth } from "~/composables/api/auth/useAuth"; // types @@ -16,6 +17,8 @@ const useGetBranch = ( const { $axios: axios } = useNuxtApp(); + const { isLoggedIn } = useAuth(); + // method const handleGetChat = async ({ productId, limit, offset }: { @@ -37,7 +40,7 @@ const useGetBranch = ( }; return useInfiniteQuery({ - enabled, + enabled: isLoggedIn, queryKey: [QUERY_KEYS.chat], initialPageParam: { limit: 10,