add delete and change status functionalities

This commit is contained in:
2022-11-19 18:36:35 +01:00
parent 41b49d6306
commit be69a55fea
5 changed files with 170 additions and 9 deletions

View File

@@ -7,13 +7,10 @@ import { Loader } from "./loader";
export const AuthRedirect: FC<{ children: ReactNode }> = ({ children }) => {
const router = useRouter();
const { data: user, isLoading, isError } = useMeQuery();
console.log(user);
const isAuthPage = router.pathname === "/login";
useEffect(() => {
console.log("here");
if (!isLoading && !user && !isAuthPage) {
console.log("here");
router.push("/login");
}
}, [user, isError, isLoading, isAuthPage, router]);