bitwarden-estensione-browser/src/popup/vault/share.component.ts

45 lines
1.6 KiB
TypeScript
Raw Normal View History

import { Location } from '@angular/common';
import { Component } from '@angular/core';
2018-10-23 22:17:30 +02:00
import {
ActivatedRoute,
Router,
} from '@angular/router';
import { CipherService } from 'jslib/abstractions/cipher.service';
import { CollectionService } from 'jslib/abstractions/collection.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { UserService } from 'jslib/abstractions/user.service';
import { ShareComponent as BaseShareComponent } from 'jslib/angular/components/share.component';
@Component({
selector: 'app-vault-share',
templateUrl: 'share.component.html',
})
export class ShareComponent extends BaseShareComponent {
constructor(collectionService: CollectionService, platformUtilsService: PlatformUtilsService,
i18nService: I18nService, userService: UserService,
cipherService: CipherService, private route: ActivatedRoute,
2018-10-23 22:17:30 +02:00
private location: Location, private router: Router) {
super(collectionService, platformUtilsService, i18nService, userService, cipherService);
}
async ngOnInit() {
2018-10-23 22:17:30 +02:00
this.onSharedCipher.subscribe(() => {
this.router.navigate(['view-cipher', { cipherId: this.cipherId }]);
});
2018-12-20 16:20:57 +01:00
const queryParamsSub = this.route.queryParams.subscribe(async (params) => {
this.cipherId = params.cipherId;
await super.ngOnInit();
2019-01-17 05:30:39 +01:00
if (queryParamsSub != null) {
queryParamsSub.unsubscribe();
}
});
}
cancel() {
this.location.back();
}
}