-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
402e4c6
commit f6836d2
Showing
5 changed files
with
77 additions
and
57 deletions.
There are no files selected for viewing
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,34 @@ | ||
import HomePage from "./HomePage"; | ||
import React from "react"; | ||
import { useRouter } from "next/router"; | ||
import { useSession } from "next-auth/client"; | ||
import urls from "../../../../utils/urls"; | ||
import classes from "./HomePage.module.scss"; | ||
|
||
const HomePage: React.FC = () => { | ||
const router = useRouter(); | ||
const [session, loading] = useSession(); | ||
|
||
React.useEffect(() => { | ||
if (!loading && !session) { | ||
void router.replace(urls.pages.index); | ||
} | ||
}, [router, loading, session]); | ||
|
||
if (loading) { | ||
return <h1>Loading...</h1>; | ||
} | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<h2 className={classes.centerText}> | ||
Welcome to our app, {session?.user?.name ?? "User"}! | ||
</h2> | ||
<h3> | ||
This page can only be accessed by logged-in users, because _app.js | ||
reroutes users who are not logged-in away from this page. | ||
</h3> | ||
</div> | ||
); | ||
}; | ||
|
||
export default HomePage; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,35 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"lib": ["dom", "dom.iterable", "esnext"], | ||
/* Basic Options */ | ||
"jsx": "react", | ||
"lib": ["es6"], | ||
"noEmit": true, | ||
"allowJs": true, | ||
"target": "esnext", | ||
"module": "commonjs", | ||
"isolatedModules": true, | ||
|
||
/* Strict Type-Checking Options */ | ||
"strict": true /* Enable all strict type-checking options. */, | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"noEmit": true, | ||
|
||
/* Module Resolution Options */ | ||
"baseUrl": "./src", | ||
"esModuleInterop": true, | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"paths": { | ||
"&pages/*": ["./pages/*"], | ||
"&utils/*": ["../utils/*"], | ||
"&styles/*": ["./styles/*"], | ||
"&screens/*": ["./screens/*"], | ||
"&actions/*": ["./actions/*"], | ||
"&components/*": ["./components/*"] | ||
}, | ||
"allowSyntheticDefaultImports": true, | ||
|
||
/* Experimental Options */ | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"jsx": "preserve", | ||
"baseUrl": "." | ||
"experimentalDecorators": true | ||
}, | ||
"exclude": ["node_modules"], | ||
"include": [ | ||
"next-env.d.ts", | ||
".eslintrc.json", | ||
"**/*.ts", | ||
"**/*.tsx", | ||
"**/*.js", | ||
"**/*.jsx", | ||
"**/*.json" | ||
] | ||
"exclude": ["node_modules"] | ||
} |