import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import Image from 'next/image' import { useRouter } from 'next/router' import { FunctionComponent } from 'react' import { matchProtectedRoute } from '../utils/tools' import useLocalStorage from '../utils/useLocalStorage' const Auth: FunctionComponent<{ redirect: string }> = ({ redirect }) => { const authTokenPath = matchProtectedRoute(redirect) const router = useRouter() const [token, setToken] = useLocalStorage(authTokenPath, '') return (
This route (the folder itself and the files inside) is password protected. If you know the password, please enter it below.
{ setToken(e.target.value) }} onKeyPress={e => { if (e.key === 'Enter' || e.key === 'NumpadEnter') { router.reload() } }} />