Tranga-Website/Website/modules/interfaces/IFrontendSettings.tsx
glax f426a77f25 Simplified frontend setting creation.
Added ability to reset UserAgent
2024-10-23 02:50:26 +02:00

18 lines
542 B
TypeScript

import {Cookies} from "react-cookie";
export default interface IFrontendSettings {
jobInterval: Date;
apiUri: string;
}
export function LoadFrontendSettings(): IFrontendSettings {
const cookies = new Cookies();
return {
jobInterval: cookies.get('jobInterval') === undefined
? new Date(0,0,0,3)
: cookies.get('jobInterval'),
apiUri: cookies.get('apiUri') === undefined
? `${window.location.protocol}//${window.location.host}/api`
: cookies.get('apiUri')
}
}