Skip to content

Commit

Permalink
added redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhravya committed Aug 13, 2022
1 parent 8e1de05 commit 9aa14f1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
30 changes: 16 additions & 14 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import React from 'react'
import {useSession} from "next-auth/react"
import { useRouter } from 'next/router'
import React, { useEffect } from "react";
import { useSession } from "next-auth/react";
import { useRouter } from "next/router";
import { NextPageContext } from "next";

function Index() {
const session = useSession()
const router = useRouter()
return <div>LMFAO</div>;
}

export async function getServerSideProps(context: NextPageContext) {
// TODO: redirect to website if user is not logged in

// TODO: @yxshv pls lol
// If user is logged in, redirect to /home.
// otherwise, redirect to what-is.lmfao.tech
return (
<div>
LMFAO
</div>
)
return {
redirect: {
destination: "/home",
permanent: false,
},
};
}

export default Index
export default Index;
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"incremental": true,
"noUncheckedIndexedAccess": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "src/hooks/_middlware.js"],
"exclude": ["node_modules"]
}

0 comments on commit 9aa14f1

Please sign in to comment.