Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kant01ne/ffe4c65f01ba59a65ff7bade9aa00f5d to your computer and use it in GitHub Desktop.
Save kant01ne/ffe4c65f01ba59a65ff7bade9aa00f5d to your computer and use it in GitHub Desktop.
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