-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.ts
More file actions
69 lines (62 loc) · 1.61 KB
/
config.ts
File metadata and controls
69 lines (62 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import defu from "defu";
export interface Config {
cacheExpiration: {
membres: number,
poles: number,
accueil: number,
filtres: number
},
// couleurs promotions affichées
promotions: {
[promotion: string]: string
},
// couleurs pôles affichées pour les pôles
poles: {
[pole: string]: string,
}
}
const defaultConfig: Config = {
cacheExpiration: {
membres: 60 * 60, // 1 heure,
poles: 2 * 60 * 60, // 2 heures
accueil: 12 * 60 * 60, // 12 heures
filtres: 24 * 60 * 60 // 24 heures
},
// couleurs des promotions
promotions: {
// ISENx, CINx et Mx
'CIN1': '#F32132',
'ISEN1': '#F32132',
'CIN2': '#DC255A',
'ISEN2': '#DC255A',
'CIN3': '#C42881',
'ISEN3': '#C42881',
'ISEN4': '#AD2CA9',
'M1': '#AD2CA9',
'ISEN5': '#952FD0',
'M2': '#952FD0',
//
'BIOST1': '#596F62',
'BIOST2': '#3B5053'
},
poles: {
'Dev': 'rgb(239, 68, 68)',
'Cyber': 'rgb(13, 148, 136)',
'Innovation': 'rgb(56, 189, 248)',
'Serveur': 'rgb(37, 99, 235)'
}
}
export default async (): Promise<Config> => {
const payload = await fetch('/config/', {
method: 'GET',
})
if(payload.status == 200 && payload.headers.get('content-type') === 'application/json') {
try {
const config = await payload.json();
return defu(config, defaultConfig);
} catch(error) {
console.error(error)
}
}
return defaultConfig;
}