Пытаюсь реализовать состояние аутентификации, но мой редьюсер почему-то ругается
auth.reducer.ts
import {AuthActions, authActionsType} from "./auth.actions";
import {ActionReducer} from "@ngrx/store";
export interface AuthState {
authStatus: boolean
}
const initialState: AuthState = {
authStatus: false
}
export const authReducer = (state = initialState, action: AuthActions) => {
switch (action.type) {
case authActionsType.signIn:
return {
...state,
authStatus: true
}
case authActionsType.logOut:
return {
...state,
authStatus: false
}
default:
return state
}
}
auth.actions.ts
import { Action } from '@ngrx/store'
export enum authActionsType {
signIn = '[AUTH] sign in',
logOut = '[AUTH] log out'
}
export class SignInAction implements Action {
readonly type = authActionsType.signIn
}
export class LogOutAction implements Action {
readonly type = authActionsType.logOut
}
export type AuthActions = SignInAction | LogOutAction
index.ts
import { Action, ActionReducerMap, MetaReducer } from '@ngrx/store'
import { environment } from '../../environments/environment'
import {authReducer, AuthState} from './auth/auth.reducer'
export interface State {
auth: AuthState
}
export const reducers: ActionReducerMap<State> = {
auth: authReducer
}
export const metaReducers: MetaReducer<State>[] = !environment.production
? []
: []
Ну и сама ошибка