Alert Service

class AlertService

alert.service.ts
import { Injectable, Signal, inject } from '@angular/core';
import {
  MatSnackBar,
  MatSnackBarRef,
  TextOnlySnackBar,
} from '@angular/material/snack-bar';
import { LanguageOption } from '@jet/interfaces/language-option.interface';
import { TranslocoService } from '@jsverse/transloco';
import { take } from 'rxjs';
import { LoggerService } from '../logger/logger.service';
import { SettingsService } from '../settings/settings.service';

@Injectable({
  providedIn: 'root',
})
export class AlertService {
  private readonly _matSnackBar = inject(MatSnackBar);
  private readonly _translocoService = inject(TranslocoService);
  private readonly _loggerService = inject(LoggerService);
  private readonly _settingsService = inject(SettingsService);

  private readonly _languageOption: Signal<LanguageOption>;

  public constructor() {
    // Buy to unlock
  }

  public showAlert(
    message: string,
    cta: string = this._translocoService.translate('alerts.ok'),
    action?: () => void,
  ): void {
    // Buy to unlock
  }

  public showErrorAlert(
    message: string = this._translocoService.translate(
      'alerts.something-went-wrong',
    ),
  ): void {
    // Buy to unlock
  }
}

Last updated

Was this helpful?