Enable chat api when isLoggedIn is true
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user