member_webapp/@overflow/member/store/container/email-auth/email-auth.reducer.ts

66 lines
1.2 KiB
TypeScript
Raw Normal View History

2018-05-31 10:20:14 +00:00
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;
}
}
}