static token(state: AuthStateModel): string | null {
static isAuthenticated(state: AuthStateModel): boolean {
constructor(private authService: AuthService) {}
login(ctx: StateContext<AuthStateModel>, action: Login) {
return this.authService.login(action.payload).pipe(
tap((result: { token: string }) => {
username: action.payload.username
logout(ctx: StateContext<AuthStateModel>) {
const state = ctx.getState();
return this.authService.logout(state.token).pipe(