Enable chat api when isLoggedIn is true

This commit is contained in:
marzban-dev
2025-01-16 16:01:53 +03:30
parent 2af9ab6e8c
commit 0a54b99aef
+4 -1
View File
@@ -2,6 +2,7 @@
import { useInfiniteQuery } from "@tanstack/vue-query"; import { useInfiniteQuery } from "@tanstack/vue-query";
import { API_ENDPOINTS, QUERY_KEYS } from "~/constants"; import { API_ENDPOINTS, QUERY_KEYS } from "~/constants";
import { useAuth } from "~/composables/api/auth/useAuth";
// types // types
@@ -16,6 +17,8 @@ const useGetBranch = (
const { $axios: axios } = useNuxtApp(); const { $axios: axios } = useNuxtApp();
const { isLoggedIn } = useAuth();
// method // method
const handleGetChat = async ({ productId, limit, offset }: { const handleGetChat = async ({ productId, limit, offset }: {
@@ -37,7 +40,7 @@ const useGetBranch = (
}; };
return useInfiniteQuery({ return useInfiniteQuery({
enabled, enabled: isLoggedIn,
queryKey: [QUERY_KEYS.chat], queryKey: [QUERY_KEYS.chat],
initialPageParam: { initialPageParam: {
limit: 10, limit: 10,