fix(website): migration from old website

This commit is contained in:
iCrawl
2023-04-01 15:50:47 +02:00
parent 74a6d59ae9
commit e2f39ccc32
5 changed files with 54 additions and 1 deletions

View File

@@ -0,0 +1,13 @@
'use client';
import { useEffect } from 'react';
export function useSystemThemeFallback() {
useEffect(() => {
const theme = localStorage.getItem('theme');
if (theme === 'auto') {
localStorage.setItem('theme', 'system');
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}

View File

@@ -0,0 +1,14 @@
'use client';
import { useEffect } from 'react';
export function useUnregisterServiceWorker() {
useEffect(() => {
// eslint-disable-next-line promise/prefer-await-to-then
void navigator.serviceWorker.getRegistrations().then((registrations) => {
for (const registration of registrations) {
void registration.unregister();
}
});
}, []);
}