From ee4297280c1305c7e03bedd4df63ccf136c28c6c Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Tue, 24 Jan 2023 15:54:48 +0700 Subject: Merapihkan struktur folder --- src/components/WithAuth.js | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 src/components/WithAuth.js (limited to 'src/components/WithAuth.js') diff --git a/src/components/WithAuth.js b/src/components/WithAuth.js deleted file mode 100644 index 74518b3b..00000000 --- a/src/components/WithAuth.js +++ /dev/null @@ -1,20 +0,0 @@ -import { useRouter } from "next/router"; -import { useEffect, useState } from "react"; -import { getAuth } from "../helpers/auth"; - -const WithAuth = ({ children }) => { - const router = useRouter(); - const [response, setResponse] = useState(<>); - - useEffect(() => { - if (!getAuth()) { - router.replace('/login'); - } else { - setResponse(children); - } - }, [children, router]); - - return response; -} - -export default WithAuth; \ No newline at end of file -- cgit v1.2.3