• Почему action.payload is undefined?

    @programTop
    Нужно переписать extraReducers под новый формат:
    extraReducers: (builder) => {
    builder
    .addCase(registerUser.pending, (state) => {
    state.isLoading = true;
    state.status = null;
    })
    .addCase(registerUser.fulfilled, (state, action) => {
    state.isLoading = false;
    state.status = action.payload.message;
    state.user = action.payload.newUser;
    state.token = action.payload.token;
    })
    .addCase(registerUser.rejected, (state, action) => {
    state.isLoading = false;
    state.status = action.payload.message;
    });
    },

    Типо так )
    Ответ написан
    Комментировать