diff --git a/pages/_app.tsx b/pages/_app.tsx index 85be7a4..0cf0cb1 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -1,5 +1,5 @@ // React, NextJS imports -import React from 'react'; +import React, { useEffect } from 'react'; // import localFont from '@next/font/local'; import type { AppProps } from 'next/app'; @@ -14,9 +14,22 @@ import { ThemeProvider as GlobalThemeProvider } from '../contexts/ThemeContext'; import { DataProvider } from '../contexts/DataContext'; import { QueryClient, QueryClientProvider } from 'react-query'; +import { useRouter } from 'next/dist/client/router'; const queryClient = new QueryClient(); export default function App({ Component, pageProps }: AppProps) { + const router = useRouter(); + + useEffect(() => { + // Check for the redirect parameter + const redirect = new URLSearchParams(window.location.search).get( + 'redirect' + ); + if (redirect) { + router.replace(redirect); // Navigate to the original path + } + }, [router]); + return ( diff --git a/public/404.html b/public/404.html index 47bd3f6..4f40b95 100644 --- a/public/404.html +++ b/public/404.html @@ -1,10 +1,6 @@