in src/redux/reducers/user.js [25:55]
export default function (state = initState(), action) {
switch (action.type) {
case SET_USER: {
const { user } = action.payload;
if (!user) {
return { user: initState() }
}
return { id: user.id, username: user.username, attributes: user.attributes }
}
case SET_USER_EMAIL: {
const { email } = action.payload;
const _user = state;
_user.attributes.email = email;
return { id: _user.id, username: _user.username, attributes: _user.attributes };
}
case SET_USER_PHONENUMBER: {
const { phoneNumber } = action.payload;
const _user = state;
_user.attributes.phone_number = phoneNumber;
return { id: _user.id, username: _user.username, attributes: _user.attributes };
}
default:
return state;
}
}