mirror of
https://github.com/C9Glax/tranga-website.git
synced 2025-06-15 16:27:54 +02:00
Simplified frontend setting creation.
Added ability to reset UserAgent
This commit is contained in:
@ -5,27 +5,14 @@ export default interface IFrontendSettings {
|
||||
apiUri: string;
|
||||
}
|
||||
|
||||
export function FrontendSettingsWith(settings: IFrontendSettings | undefined, jobInterval: Date | undefined, apiUri: string | undefined): IFrontendSettings {
|
||||
export function LoadFrontendSettings(): IFrontendSettings {
|
||||
const cookies = new Cookies();
|
||||
let transform : IFrontendSettings;
|
||||
if(settings === undefined) {
|
||||
transform = {
|
||||
apiUri: apiUri === undefined
|
||||
? cookies.get('apiUri') === undefined
|
||||
? `${window.location.protocol}//${window.location.host}/api`
|
||||
: cookies.get('apiUri')
|
||||
: apiUri,
|
||||
jobInterval: jobInterval === undefined
|
||||
? cookies.get('jobInterval') === undefined
|
||||
? new Date(0,0,0,3)
|
||||
: cookies.get('jobInterval')
|
||||
: jobInterval
|
||||
}
|
||||
}else {
|
||||
transform = {
|
||||
apiUri: apiUri === undefined ? settings.apiUri : apiUri,
|
||||
jobInterval: jobInterval === undefined ? settings.jobInterval : jobInterval,
|
||||
}
|
||||
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')
|
||||
}
|
||||
return transform;
|
||||
}
|
Reference in New Issue
Block a user