mirror of
https://github.com/ershisan99/todolist_next.git
synced 2026-01-26 12:35:28 +00:00
switch to bun + biomejs
fix infinite load on failed token refresh
This commit is contained in:
@@ -9,14 +9,14 @@ import { useMeQuery } from "@/services";
|
||||
|
||||
export const AuthRedirect: FC<{ children: ReactNode }> = ({ children }) => {
|
||||
const router = useRouter();
|
||||
const { data: user, isLoading, isError } = useMeQuery();
|
||||
const { data: user, isLoading } = useMeQuery();
|
||||
const isAuthPage = router.pathname === "/login";
|
||||
|
||||
useEffect(() => {
|
||||
if (!isLoading && !user && !isAuthPage) {
|
||||
router.push("/login");
|
||||
}
|
||||
}, [user, isError, isLoading, isAuthPage, router]);
|
||||
}, [user, isLoading, isAuthPage, router]);
|
||||
|
||||
if (isLoading || (!user && !isAuthPage)) {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user