1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 15:53:27 +00:00

migrate platform toasts to CL toastService (#10666)

This commit is contained in:
Jordan Aasen
2024-08-22 10:12:27 -07:00
committed by GitHub
parent d2d49b254d
commit 898338ff9d
2 changed files with 17 additions and 14 deletions

View File

@@ -5,7 +5,7 @@ import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { ToastService } from "@bitwarden/components";
// Replace this with a type safe lookup of the feature flag values in PM-2282
type FlagValue = boolean | number | string;
@@ -24,7 +24,7 @@ export const canAccessFeature = (
): CanActivateFn => {
return async () => {
const configService = inject(ConfigService);
const platformUtilsService = inject(PlatformUtilsService);
const toastService = inject(ToastService);
const router = inject(Router);
const i18nService = inject(I18nService);
const logService = inject(LogService);
@@ -36,7 +36,11 @@ export const canAccessFeature = (
return true;
}
platformUtilsService.showToast("error", null, i18nService.t("accessDenied"));
toastService.showToast({
variant: "error",
title: null,
message: i18nService.t("accessDenied"),
});
if (redirectUrlOnDisabled != null) {
return router.createUrlTree([redirectUrlOnDisabled]);