Accept url parameter for custom delay

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2022-05-06 14:50:22 +02:00
parent bd58bca39c
commit 1a18f3fc6f

View file

@ -12,7 +12,11 @@ import { fetchFrontendConfig } from './fetch-frontend-config'
import { loadDarkMode } from './load-dark-mode'
const customDelay: () => Promise<void> = async () => {
if (window.localStorage.getItem('customDelay')) {
if (
typeof window !== 'undefined' &&
typeof window.localStorage !== 'undefined' &&
(window.location.search.startsWith('?customDelay=') || window.localStorage.getItem('customDelay'))
) {
return new Promise((resolve) => setTimeout(resolve, 5000))
} else {
return Promise.resolve()