2020-12-19 03:38:04 +02:00
|
|
|
export function reducer(state, action) {
|
|
|
|
switch (action.type) {
|
2020-12-19 04:22:38 +02:00
|
|
|
case "onCredentialsChange": {
|
|
|
|
const { prop, value } = action.payload;
|
2020-12-19 03:38:04 +02:00
|
|
|
return {
|
|
|
|
...state,
|
2020-12-19 04:22:38 +02:00
|
|
|
credentials: {
|
|
|
|
...state.credentials,
|
|
|
|
[prop]: value
|
2020-12-19 03:38:04 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export const dispatchActions = dispatch => ({
|
2020-12-19 04:22:38 +02:00
|
|
|
onCredentialsChange: (prop, value) =>
|
|
|
|
dispatch({ type: "onCredentialsChange", payload: { prop, value } })
|
2020-12-19 03:38:04 +02:00
|
|
|
});
|