Created
December 9, 2020 14:02
-
-
Save kant01ne/ffe4c65f01ba59a65ff7bade9aa00f5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Head from 'next/head'; | |
import React, { useEffect } from 'react'; | |
import 'regenerator-runtime/runtime'; | |
import styles from '../../styles/Home.module.css'; | |
import dynamic from 'next/dynamic'; | |
import SuperTokens from 'supertokens-auth-react'; | |
const SuperTokensComponentNoSSR = dynamic(() => import('supertokens-auth-react').then(mod => { | |
return () => mod.getRoutingComponent() || null; | |
}), { | |
ssr: false | |
}); | |
export default function Auth() { | |
useEffect(() => { | |
if (SuperTokens.canHandleRoute() === false) { | |
window.location.href = "/"; | |
} | |
}, []); | |
return ( | |
<div className={styles.container}> | |
<Head> | |
<title>Create Next App</title> | |
<link rel="icon" href="/favicon.ico" /> | |
</Head> | |
<main className={styles.main}> | |
<SuperTokensComponentNoSSR /> | |
</main> | |
</div> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment