From d2ca59adb8e00d4224e9e17ad04fef1ebfdf331f Mon Sep 17 00:00:00 2001 From: Alex van Andel Date: Fri, 7 May 2021 15:04:56 +0000 Subject: [PATCH] Added redirects() function to next.config.js, changed Settings url --- components/Shell.tsx | 2 +- next.config.js | 9 +++++++++ pages/settings/index.tsx | 19 ------------------- 3 files changed, 10 insertions(+), 20 deletions(-) delete mode 100644 pages/settings/index.tsx diff --git a/components/Shell.tsx b/components/Shell.tsx index 3810f5d5..16bc4580 100644 --- a/components/Shell.tsx +++ b/components/Shell.tsx @@ -56,7 +56,7 @@ export default function Shell(props) { Integrations - + Settings diff --git a/next.config.js b/next.config.js index 9ffb8597..4b172ebd 100644 --- a/next.config.js +++ b/next.config.js @@ -22,4 +22,13 @@ module.exports = withTM({ typescript: { ignoreBuildErrors: true, }, + async redirects() { + return [ + { + source: '/settings', + destination: '/settings/profile', + permanent: true, + } + ] + } }); diff --git a/pages/settings/index.tsx b/pages/settings/index.tsx deleted file mode 100644 index dd0adcff..00000000 --- a/pages/settings/index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { useRouter } from 'next/router'; -import { signIn, useSession, getSession } from 'next-auth/client'; - -export default function Settings() { - const [ session, loading ] = useSession(); - const router = useRouter(); - - if (loading) { - return

Loading...

; - } else { - if (!session) { - window.location.href = "/auth/login"; - } - } - - router.replace('/settings/profile'); - - return null; -} \ No newline at end of file