diff options
author | Chocobozzz <me@florianbigard.com> | 2021-05-14 16:12:45 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-05-27 16:00:13 +0200 |
commit | 0f01a8bacddf6c502e6470e34fdac7750bb76e89 (patch) | |
tree | c0eb33e4b74f955979f2cb9ee747dfc81d7ff4fb /client/src/app/core/routing/meta-guard.service.ts | |
parent | 05ded92ed16bc83a33e71ecccf0f3ee9751fd7b0 (diff) | |
download | PeerTube-0f01a8bacddf6c502e6470e34fdac7750bb76e89.tar.gz PeerTube-0f01a8bacddf6c502e6470e34fdac7750bb76e89.tar.zst PeerTube-0f01a8bacddf6c502e6470e34fdac7750bb76e89.zip |
Remove ngx-meta
Unmaintained
Diffstat (limited to 'client/src/app/core/routing/meta-guard.service.ts')
-rw-r--r-- | client/src/app/core/routing/meta-guard.service.ts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/client/src/app/core/routing/meta-guard.service.ts b/client/src/app/core/routing/meta-guard.service.ts new file mode 100644 index 000000000..bedb3450e --- /dev/null +++ b/client/src/app/core/routing/meta-guard.service.ts | |||
@@ -0,0 +1,23 @@ | |||
1 | import { Injectable } from '@angular/core' | ||
2 | import { ActivatedRouteSnapshot, CanActivate, CanActivateChild, RouterStateSnapshot } from '@angular/router' | ||
3 | import { MetaService } from './meta.service' | ||
4 | |||
5 | @Injectable() | ||
6 | export class MetaGuard implements CanActivate, CanActivateChild { | ||
7 | |||
8 | constructor (private meta: MetaService) { } | ||
9 | |||
10 | canActivate (route: ActivatedRouteSnapshot): boolean { | ||
11 | const metaSettings = route.data?.meta | ||
12 | |||
13 | if (metaSettings) { | ||
14 | this.meta.update(metaSettings) | ||
15 | } | ||
16 | |||
17 | return true | ||
18 | } | ||
19 | |||
20 | canActivateChild (route: ActivatedRouteSnapshot): boolean { | ||
21 | return this.canActivate(route) | ||
22 | } | ||
23 | } | ||