1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-21 10:43:35 +00:00

[PM-6564] migrate auth toasts to CL toastService (#10665)

* migrate auth toasts to CL toastService

* fix component args

* fix component args

* fix specs

* fix toastService args
This commit is contained in:
Jordan Aasen
2024-08-27 10:33:58 -07:00
committed by GitHub
parent e255d84121
commit 9041a4cd4c
75 changed files with 782 additions and 457 deletions

View File

@@ -6,6 +6,7 @@ import { EnvironmentService } from "@bitwarden/common/platform/abstractions/envi
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { Utils } from "@bitwarden/common/platform/misc/utils";
import { ToastService } from "@bitwarden/components";
@Component({
selector: "app-accessibility-cookie",
@@ -25,6 +26,7 @@ export class AccessibilityCookieComponent {
protected environmentService: EnvironmentService,
protected i18nService: I18nService,
protected ngZone: NgZone,
private toastService: ToastService,
) {}
registerhCaptcha() {
@@ -42,28 +44,28 @@ export class AccessibilityCookieComponent {
}
onCookieSavedSuccess() {
this.platformUtilsService.showToast(
"success",
null,
this.i18nService.t("accessibilityCookieSaved"),
);
this.toastService.showToast({
variant: "success",
title: null,
message: this.i18nService.t("accessibilityCookieSaved"),
});
}
onCookieSavedFailure() {
this.platformUtilsService.showToast(
"error",
null,
this.i18nService.t("noAccessibilityCookieSaved"),
);
this.toastService.showToast({
variant: "error",
title: null,
message: this.i18nService.t("noAccessibilityCookieSaved"),
});
}
async submit() {
if (Utils.getHostname(this.accessibilityForm.value.link) !== "accounts.hcaptcha.com") {
this.platformUtilsService.showToast(
"error",
this.i18nService.t("errorOccurred"),
this.i18nService.t("invalidUrl"),
);
this.toastService.showToast({
variant: "error",
title: this.i18nService.t("errorOccurred"),
message: this.i18nService.t("invalidUrl"),
});
return;
}
this.listenForCookie = true;