Я использую функцию createSelector
У меня есть проблема, которую я не смог решить, и я достиг точки, когда я не знаю, что делать
export const getRecoveryIsOpen = createSelector(
getRecoveryPasswordState,
fromRecoveryPassword.getRecoveryPasswordIsOpen
)
Итак, япризовите ее
this.store.select(reducers.getRecoveryState).subscribe( isBlur => {
console.log(isBlur)
})
Pero siempre me sale el mismo error al momento de cargar la pagina.y en el Redux devtools estan los estados cargados correctamente
ERROR TypeError: Cannot read property 'isOpen' of undefined
at getRecoveryPasswordIsOpen (recovery-password.reducer.ts:65)
at store.js:938
at memoized (store.js:853)
at defaultStateFn (store.js:893)
at store.js:947
at memoized (store.js:853)
at MapSubscriber.project (store.js:772)
at MapSubscriber._next (map.js:29)
at MapSubscriber.next (Subscriber.js:49)
at MapSubscriber._next (map.js:35)
это мой recovery-password.reducer
import * as RecoveryPasswordActions from '../actions/recovery-password.actions';
import { RecoveryPasswordActionTypes } from '../actions/recovery-password.actions';
export interface State {
identificacion: number;
error: String;
currentStep: number;
isOpen: boolean;
}
const initialState: State = {
identificacion: null,
error: "",
currentStep: 1,
isOpen: false
}
export function RecoveryPasswordReducer(state: State = initialState, action: RecoveryPasswordActions.actions) {
switch (action.type) {
case RecoveryPasswordActionTypes.OpenRecoveryPassword:
return {
...state,
isOpen: true
}
case RecoveryPasswordActionTypes.CloseRecoveryPassword:
return {
...state,
isOpen: false
}
case RecoveryPasswordActionTypes.SendIdUser:
return {
...state,
identificacion: action.payload.identificacion
}
case RecoveryPasswordActionTypes.SendIdUserError:
return {
...state,
error: action.payload.error
}
case RecoveryPasswordActionTypes.SendIdUserSuccess:
return {
...state,
currentStep: 2
}
case RecoveryPasswordActionTypes.SendRecoveryMethod:
return {
...state,
recoveryMethod: action.payload.recoveryMethod
}
default:
return state;
}
}
export const getRecoveryPasswordState = (state: State) => state;
export const getRecoveryPasswordIsOpen = (state: State) => state.isOpen;
export const getRecoveryPasswordCurrentStep = (state: State) => state.currentStep;
export const getRecoveryPasswordError = (state: State) => state.error;
Я много просмотрел и действительно не вижу ошибокЯ хотел бы знать, если я делаю что-то не так.