66 lines
1.2 KiB
TypeScript
66 lines
1.2 KiB
TypeScript
import {
|
|
Actions,
|
|
ActionType,
|
|
} from '../../entity/member/member.action';
|
|
|
|
import {
|
|
State,
|
|
initialState,
|
|
} from './email-auth.state';
|
|
|
|
export function reducer(state = initialState, action: Actions): State {
|
|
switch (action.type) {
|
|
case ActionType.ConfirmEmailForSignup: {
|
|
return {
|
|
emailAuth: null,
|
|
pending: true,
|
|
error: null,
|
|
};
|
|
}
|
|
|
|
case ActionType.ConfirmEmailForSignupSuccess: {
|
|
return {
|
|
emailAuth: action.payload,
|
|
pending: false,
|
|
error: null,
|
|
};
|
|
}
|
|
|
|
case ActionType.ConfirmEmailForSignupFailure: {
|
|
return {
|
|
emailAuth: null,
|
|
pending: false,
|
|
error: action.payload,
|
|
};
|
|
}
|
|
|
|
case ActionType.ConfirmEmailForPassword: {
|
|
return {
|
|
emailAuth: null,
|
|
pending: true,
|
|
error: null,
|
|
};
|
|
}
|
|
|
|
case ActionType.ConfirmEmailForPasswordSuccess: {
|
|
return {
|
|
emailAuth: action.payload,
|
|
pending: true,
|
|
error: null,
|
|
};
|
|
}
|
|
|
|
case ActionType.ConfirmEmailForPasswordFailure: {
|
|
return {
|
|
emailAuth: null,
|
|
pending: true,
|
|
error: action.payload,
|
|
};
|
|
}
|
|
|
|
default: {
|
|
return state;
|
|
}
|
|
}
|
|
}
|