mirror of
https://github.com/9technologygroup/patchmon.net.git
synced 2025-11-14 19:05:44 +00:00
fix(frontend): don't query settings before auth
This commit is contained in:
@@ -1,11 +1,16 @@
|
|||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
|
import { isAuthReady } from "../constants/authPhases";
|
||||||
|
import { useAuth } from "../contexts/AuthContext";
|
||||||
import { settingsAPI } from "../utils/api";
|
import { settingsAPI } from "../utils/api";
|
||||||
|
|
||||||
const LogoProvider = ({ children }) => {
|
const LogoProvider = ({ children }) => {
|
||||||
|
const { authPhase, isAuthenticated } = useAuth();
|
||||||
|
|
||||||
const { data: settings } = useQuery({
|
const { data: settings } = useQuery({
|
||||||
queryKey: ["settings"],
|
queryKey: ["settings"],
|
||||||
queryFn: () => settingsAPI.get().then((res) => res.data),
|
queryFn: () => settingsAPI.get().then((res) => res.data),
|
||||||
|
enabled: isAuthReady(authPhase, isAuthenticated()),
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user