File

src/lib/sign-out.directive.ts

Metadata

Index

Methods
Outputs
HostListeners

Constructor

constructor(auth: RxapAuthenticationService)
Parameters :
Name Type Optional
auth RxapAuthenticationService No

Outputs

failure
Type : EventEmitter
successful
Type : EventEmitter

HostListeners

click

Methods

Public Async onClick
onClick()
Decorators :
@HostListener('click')
Returns : any
import {
  Directive,
  EventEmitter,
  HostListener,
  Output,
} from '@angular/core';
import { RxapAuthenticationService } from './authentication.service';

@Directive({
  selector: '[rxapSignOut]',
  standalone: true,
})
export class SignOutDirective {

  @Output()
  public successful = new EventEmitter<void>();

  @Output()
  public failure = new EventEmitter<Error>();

  constructor(private readonly auth: RxapAuthenticationService) {
  }

  @HostListener('click')
  public async onClick() {
    try {
      await this.auth.signOut();
      this.successful.emit();
    } catch (e: any) {
      this.failure.emit(e);
    }
  }

}


results matching ""

    No results matching ""