mirror of
https://github.com/dyzulk/trustlab.git
synced 2026-01-26 13:32:06 +07:00
fix: refactor direct SWR calls to useAuth to prevent 401 loops
This commit is contained in:
@@ -44,12 +44,14 @@ import PageLoader from "@/components/ui/PageLoader";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useI18n } from "@/components/providers/I18nProvider";
|
||||
|
||||
import { useAuth } from "@/hooks/useAuth";
|
||||
|
||||
const fetcher = (url: string) => axios.get(url).then((res) => res.data);
|
||||
|
||||
export default function SettingsClient() {
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
const { data: user, mutate: mutateUser } = useSWR("/api/user", fetcher);
|
||||
const { user, mutate: mutateUser } = useAuth();
|
||||
const { data: loginHistory, isLoading: historyLoading } = useSWR("/api/profile/login-history", fetcher);
|
||||
const { data: sessions, isLoading: sessionsLoading } = useSWR("/api/profile/sessions", fetcher);
|
||||
const { data: apiKeys } = useSWR("/api/api-keys", fetcher);
|
||||
|
||||
Reference in New Issue
Block a user