member_webapp/@overflow/shared/auth/store/auth/auth.reducer.ts
crusader 46c1c55d61 ing
2018-06-01 18:45:28 +09:00

46 lines
818 B
TypeScript

import {
Actions,
ActionType,
} from './auth.action';
import {
State,
initialState,
} from './auth.state';
export function reducer(state: State = initialState, action: Actions): State {
switch (action.type) {
case ActionType.SigninSuccess: {
return {
signined: true,
domainMember: action.payload.domainMember,
};
}
case ActionType.SigninCookieSuccess: {
return {
signined: true,
domainMember: action.payload.domainMember,
};
}
case ActionType.SignoutSuccess: {
return {
signined: false,
domainMember: null,
};
}
case ActionType.ModifySuccess: {
state.domainMember.member = action.payload;
return {
...state,
};
}
default: {
return state;
}
}
}