-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapplication.ts
34 lines (29 loc) · 1.06 KB
/
application.ts
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
import Route from '@ember/routing/route';
import { service } from '@ember/service';
import type PlausibleService from 'ember-plausible/services/plausible';
import config from 'frontend-burgernabije-besluitendatabank/config/environment';
import type GoverningBodyDisabledList from 'frontend-burgernabije-besluitendatabank/services/governing-body-disabled-list';
export default class ApplicationRoute extends Route {
@service declare plausible: PlausibleService;
@service declare governingBodyDisabledList: GoverningBodyDisabledList;
beforeModel(): void {
this.startAnalytics();
this.setGoverningBodyDisabledList();
}
startAnalytics(): void {
const { domain, apiHost } = config.plausible;
if (!domain.startsWith('{{') && !apiHost.startsWith('{{')) {
this.plausible.enable({
domain,
apiHost,
});
}
}
setGoverningBodyDisabledList(): void {
this.governingBodyDisabledList.disabledList = !config[
'governing-body-disabled'
].startsWith('{{')
? config['governing-body-disabled'].split(',')
: [];
}
}