45 lines
824 B
TypeScript
45 lines
824 B
TypeScript
|
import {
|
||
|
Actions as MemberActions,
|
||
|
ActionType as MemberActionType,
|
||
|
} from '../../entity/member/member.action';
|
||
|
|
||
|
import {
|
||
|
State,
|
||
|
initialState,
|
||
|
} from './member-signin.state';
|
||
|
|
||
|
|
||
|
import {
|
||
|
Actions as AuthActions,
|
||
|
ActionType as AuthActionType,
|
||
|
} from '@overflow/shared/auth/store/container/auth';
|
||
|
|
||
|
export function reducer(state = initialState, action: MemberActions | AuthActions): State {
|
||
|
switch (action.type) {
|
||
|
case MemberActionType.Signin: {
|
||
|
return {
|
||
|
pending: true,
|
||
|
error: null,
|
||
|
};
|
||
|
}
|
||
|
|
||
|
case AuthActionType.SigninSuccess: {
|
||
|
return {
|
||
|
pending: false,
|
||
|
error: null,
|
||
|
};
|
||
|
}
|
||
|
|
||
|
case AuthActionType.SigninFailure: {
|
||
|
return {
|
||
|
pending: false,
|
||
|
error: action.payload,
|
||
|
};
|
||
|
}
|
||
|
|
||
|
default: {
|
||
|
return state;
|
||
|
}
|
||
|
}
|
||
|
}
|