Removed redirect clientside session logic from pages and moved to shell

This commit is contained in:
Alex van Andel committed 2021-05-07 16:01:29 +00:00
1 parent 17b880335a
commit 880c4e91a3
8 files changed
+27 -40

No files matched your search

-4
View File
@@ -13,10 +13,6 @@ export default function integration(props) {
if (loading) {
return <p className="text-gray-400">Loading...</p>;
} else {
if (!session) {
window.location.href = "/";
}
}
function toggleShowAPIKey() {
+3 -5
View File
@@ -13,10 +13,6 @@ export default function Home({ integrations }) {
if (loading) {
return <p className="text-gray-400">Loading...</p>;
} else {
if (!session) {
window.location.href = "/";
}
}
function toggleAddModal() {
@@ -181,7 +177,9 @@ const validJson = (jsonString: string) => {
export async function getServerSideProps(context) {
const session = await getSession(context);
if (!session) {
return { redirect: { permanent: false, destination: '/auth/login' } };
}
const user = await prisma.user.findFirst({
where: {
email: session.user.email,