mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-21 10:45:20 -04:00
Restructure redux code (#109)
* Restructure redux code Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de> Co-authored-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
db5bec7000
commit
570c45017c
28 changed files with 214 additions and 231 deletions
|
@ -1,20 +1,17 @@
|
|||
import { CLEAR_USER_ACTION_TYPE, ClearUserAction, SET_USER_ACTION_TYPE, SetUserAction, UserState } from './types'
|
||||
import { store } from '../../utils/store'
|
||||
import { ClearUserAction, SetUserAction, UserActionType, UserState } from './types'
|
||||
|
||||
export const setUser: (state: UserState) => void = (state: UserState) => {
|
||||
const action: SetUserAction = {
|
||||
type: SET_USER_ACTION_TYPE,
|
||||
payload: {
|
||||
state
|
||||
}
|
||||
type: UserActionType.SET_USER,
|
||||
state
|
||||
}
|
||||
store.dispatch(action)
|
||||
}
|
||||
|
||||
export const clearUser: () => void = () => {
|
||||
const action: ClearUserAction = {
|
||||
type: CLEAR_USER_ACTION_TYPE,
|
||||
payload: null
|
||||
type: UserActionType.CLEAR_USER
|
||||
}
|
||||
store.dispatch(action)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue