mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
26 lines
625 B
TypeScript
26 lines
625 B
TypeScript
import { useEffect, useState } from 'react';
|
|
import { Navigate } from 'react-router-dom';
|
|
import { dexieService } from '@app/services';
|
|
import { App } from '@app/types';
|
|
|
|
const FeatureDetection = () => {
|
|
const [unsupported, setUnsupported] = useState(false);
|
|
|
|
useEffect(() => {
|
|
const features: Promise<any>[] = [
|
|
detectIndexedDB(),
|
|
];
|
|
|
|
Promise.all(features).catch(() => setUnsupported(true));
|
|
}, []);
|
|
|
|
return unsupported
|
|
? <Navigate to={App.RouteEnum.UNSUPPORTED} />
|
|
: <></>;
|
|
|
|
function detectIndexedDB() {
|
|
return dexieService.testConnection();
|
|
}
|
|
};
|
|
|
|
export default FeatureDetection;
|