just approaching the use of ngrx and I have an unhandled error that I can't solve, try to search but nothing, here is the error.
It tells me that I have to enter 4 arguments but wherever I'll search that is the correct syntax with another alternative, does anyone know what the problem is? thank you
Here is the reducer's page, I'll post the action page too, tell me if you have some news
import { createReducer, on, Action } from '@ngrx/store';
import * as ProvaActions from './prova.actions';
import { ProvaState } from './prova.model';
export const initialState: ProvaState = {
user: {},
error: false
}
const provaReducer = createReducer(
initialState,
on(ProvaActions.editProvaSuccess, (state, action ) => ({user: action.user , error: false })),
on(ProvaActions.editProvaFailed, (state, action ) => ({ user: {}, error: true }))
);
export function reducer(state: ProvaState | undefined, action: Action) {
return provaReducer(state, action);
}
import { createAction, props } from '@ngrx/store';
export const editProva = createAction(
'[Prova] Edit',
props<{user: any}>() //payload, parametri che passo
)
export const editProvaSuccess = createAction(
'[Prova] Edit Success',
props<{user: any}>()
)
export const editProvaFailed = createAction(
'[Prova] Edit Failure')
export interface ProvaState {
user: any,
error: boolean;
}