mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 19:16:41 +07:00
redux: auth and map init
This commit is contained in:
parent
dca55a3bc4
commit
df6202c32d
17 changed files with 325 additions and 163 deletions
25
src/redux/user/reducer.js
Normal file
25
src/redux/user/reducer.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { createReducer } from 'reduxsauce';
|
||||
import { ACTIONS, EMPTY_USER } from '$redux/user/constants';
|
||||
import { DEFAULT_USER } from '$constants/auth';
|
||||
|
||||
const setUser = (state, { user }) => ({
|
||||
...state,
|
||||
...user,
|
||||
});
|
||||
|
||||
const setEditing = (state, { editing }) => ({
|
||||
...state,
|
||||
editing,
|
||||
});
|
||||
|
||||
|
||||
const HANDLERS = {
|
||||
[ACTIONS.SET_USER]: setUser,
|
||||
[ACTIONS.SET_EDITING]: setEditing,
|
||||
};
|
||||
|
||||
export const INITIAL_STATE = {
|
||||
...DEFAULT_USER
|
||||
};
|
||||
|
||||
export const userReducer = createReducer(INITIAL_STATE, HANDLERS);
|
Loading…
Add table
Add a link
Reference in a new issue