Having trouble using createReducer
with the builder syntax to update the auth
state based on user login success or failure. Running into TS2769 error specifically in the second builder.addCase
where adjusting the state for failed logins. Seeking assistance to identify and resolve the error within my code.
Here's a snippet of my code:
export interface AuthInterface {
loading: boolean;
userToken: boolean | null;
error: string | null;
success: boolean;
}
export interface AuthState {
auth: AuthInterface;
}
const initialState: AuthState = {
auth: {
loading: false,
userToken: null,
error: null,
success: false,
}
}
// REST OF THE CODE SNIPPET HERE
Error encountered:
TS2769: No overload matches this call...
If replacing
action: PayloadAction<AuthInterface>
with action: any
resolves the issue, but causing troubles with action.payload.error
.