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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

66 lines
1.9 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 { first } from "rxjs/operators";
import { CipherService } from "jslib-common/abstractions/cipher.service";
import { CollectionService } from "jslib-common/abstractions/collection.service";
import { I18nService } from "jslib-common/abstractions/i18n.service";
import { LogService } from "jslib-common/abstractions/log.service";
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
import { UserService } from "jslib-common/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,
private router: Router,
logService: LogService
) {
super(
collectionService,
platformUtilsService,
i18nService,
userService,
cipherService,
logService
);
}
async ngOnInit() {
2018-10-23 22:17:30 +02:00
this.onSharedCipher.subscribe(() => {
this.router.navigate(["view-cipher", { cipherId: this.cipherId }]);
});
this.route.queryParams.pipe(first()).subscribe(async (params) => {
this.cipherId = params.cipherId;
2019-03-06 20:31:50 +01:00
await this.load();
});
}
2019-05-10 20:10:40 +02:00
async submit(): Promise<boolean> {
const success = await super.submit();
if (success) {
this.cancel();
2019-05-10 20:10:40 +02:00
}
return success;
2021-12-21 15:43:35 +01:00
}
2019-05-10 20:10:40 +02:00
cancel() {
this.router.navigate(["/view-cipher"], {
replaceUrl: true,
queryParams: { cipherId: this.cipher.id },
});
}
}