Skip to content
This repository was archived by the owner on Oct 1, 2025. It is now read-only.

Commit 17bb6e5

Browse files
committed
Add Splash redirect
1 parent 2db73a8 commit 17bb6e5

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/core/index.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Head from 'next/head';
2-
import React, { FC } from 'react';
2+
import React, { FC, useEffect } from 'react';
33

44
import Footer from './components/Footer/index';
55
import Header from './components/Header/index';
@@ -9,6 +9,16 @@ import { AuthenticationProvider } from 'authentication/providers/AuthenticationP
99
import { SilentRenew } from 'authentication/components/SilentRenew';
1010

1111
const Core: FC = ({ children }) => {
12+
useEffect(() => {
13+
const splash = sessionStorage.getItem('splash');
14+
const isLandingPage = window.location.pathname === '/';
15+
const shouldRedirect = !splash || new Date().getTime() - new Date(splash).getTime() > 1000 * 60 * 10;
16+
if (shouldRedirect && isLandingPage) {
17+
sessionStorage.setItem('splash', `${new Date()}`);
18+
window.location.assign('https://splash.online.ntnu.no');
19+
}
20+
}, []);
21+
1222
return (
1323
<>
1424
<Head>

0 commit comments

Comments
 (0)