From 823287d3b4f53d798e13bbdaad8e592b6d2edb23 Mon Sep 17 00:00:00 2001 From: Ammaar Aslam Date: Thu, 20 Oct 2022 20:45:13 +0530 Subject: [PATCH 1/4] changed redirection method of home page --- next.config.js | 10 ++++++++++ pages/index.js | 13 +++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/next.config.js b/next.config.js index 6192a0ed..a916423b 100644 --- a/next.config.js +++ b/next.config.js @@ -1,5 +1,15 @@ /** @type {import('next').NextConfig} */ const nextConfig = { + async redirects() { + return [ + { + source: '/', + destination: '/hackrplay/2022/home', + permanent: false, + }, + ] + }, + reactStrictMode: true, swcMinify: true, images: { diff --git a/pages/index.js b/pages/index.js index d436ea3c..d77845e2 100644 --- a/pages/index.js +++ b/pages/index.js @@ -1,12 +1,9 @@ -import { useEffect } from 'react'; -import { useRouter } from 'next/router'; -import Layout from '@/components/Layout'; +import { useEffect } from "react"; +import { useRouter } from "next/router"; +import Layout from "@/components/Layout"; export default function Home() { - const router = useRouter(); - useEffect(() => { - router.push('/hackrplay/2022/home'); - }, []); + const router = useRouter(); - return ; + return ; } From 549b33bbe27cd7c08cec0f7b976d526558b340c4 Mon Sep 17 00:00:00 2001 From: Ammaar Aslam Date: Thu, 20 Oct 2022 20:45:28 +0530 Subject: [PATCH 2/4] remove unused code --- pages/index.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pages/index.js b/pages/index.js index d77845e2..a7db1247 100644 --- a/pages/index.js +++ b/pages/index.js @@ -1,9 +1,5 @@ -import { useEffect } from "react"; -import { useRouter } from "next/router"; import Layout from "@/components/Layout"; export default function Home() { - const router = useRouter(); - return ; } From 938985850c832f7682fe462e5695964aba8b11d1 Mon Sep 17 00:00:00 2001 From: Ammaar Aslam <96367405+ammaaraslam@users.noreply.github.com> Date: Wed, 26 Oct 2022 15:00:35 +0530 Subject: [PATCH 3/4] set permanent to true --- next.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/next.config.js b/next.config.js index a916423b..aab3327c 100644 --- a/next.config.js +++ b/next.config.js @@ -5,7 +5,7 @@ const nextConfig = { { source: '/', destination: '/hackrplay/2022/home', - permanent: false, + permanent: true, }, ] }, From 1e3fd1e6ef2eedf9183b214588a688d70089767a Mon Sep 17 00:00:00 2001 From: Ammaar Aslam <96367405+ammaaraslam@users.noreply.github.com> Date: Wed, 26 Oct 2022 15:04:58 +0530 Subject: [PATCH 4/4] rearrange order of redirect --- next.config.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/next.config.js b/next.config.js index aab3327c..f5546b1b 100644 --- a/next.config.js +++ b/next.config.js @@ -1,15 +1,5 @@ /** @type {import('next').NextConfig} */ const nextConfig = { - async redirects() { - return [ - { - source: '/', - destination: '/hackrplay/2022/home', - permanent: true, - }, - ] - }, - reactStrictMode: true, swcMinify: true, images: { @@ -26,6 +16,16 @@ const nextConfig = { }); return config; }, + async redirects() { + return [ + { + source: '/', + destination: '/hackrplay/2022/home', + permanent: true, + }, + ] + }, + } module.exports = nextConfig