diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-25 19:01:13 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-25 19:09:47 +0100 |
commit | f6a043df74bc755de8e658ba76a4e55980b96f66 (patch) | |
tree | fb2640669f59a89bd2f2d8ab52d296425a4c55ed /client/src/app/shared/can-deactivate-guard.service.ts | |
parent | 94a5ff8a4a75d75bb9df542a39ce8769e7a7e6a4 (diff) | |
download | PeerTube-f6a043df74bc755de8e658ba76a4e55980b96f66.tar.gz PeerTube-f6a043df74bc755de8e658ba76a4e55980b96f66.tar.zst PeerTube-f6a043df74bc755de8e658ba76a4e55980b96f66.zip |
Improve video upload guard a little bit
Diffstat (limited to 'client/src/app/shared/can-deactivate-guard.service.ts')
-rw-r--r-- | client/src/app/shared/can-deactivate-guard.service.ts | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/client/src/app/shared/can-deactivate-guard.service.ts b/client/src/app/shared/can-deactivate-guard.service.ts deleted file mode 100644 index 4239df737..000000000 --- a/client/src/app/shared/can-deactivate-guard.service.ts +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | import { Injectable } from '@angular/core' | ||
2 | import { CanDeactivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router' | ||
3 | import { Observable } from 'rxjs/Observable' | ||
4 | import { ConfirmService } from '../core' | ||
5 | |||
6 | export interface CanComponentDeactivate { | ||
7 | canDeactivate: () => Observable<boolean> | boolean | ||
8 | } | ||
9 | |||
10 | @Injectable() | ||
11 | export class CanDeactivateGuard implements CanDeactivate<CanComponentDeactivate> { | ||
12 | constructor (private confirmService: ConfirmService) { } | ||
13 | |||
14 | canDeactivate (component: CanComponentDeactivate, | ||
15 | currentRoute: ActivatedRouteSnapshot, | ||
16 | currentState: RouterStateSnapshot, | ||
17 | nextState: RouterStateSnapshot | ||
18 | ): Observable<boolean> | boolean { | ||
19 | return component.canDeactivate() || this.confirmService.confirm( | ||
20 | 'All unsaved data will be lost, are you sure you want to leave ?', | ||
21 | 'Unsaved Data' | ||
22 | ) | ||
23 | } | ||
24 | |||
25 | } | ||