hedgedoc/src/redux/user/methods.ts
Philip Molares f3bf7cd105
Added reuse information (#782)
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2020-11-22 21:50:07 +01:00

27 lines
657 B
TypeScript

/*
* SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { store } from '..'
import { ClearUserAction, SetUserAction, UserActionType, UserState } from './types'
export const setUser: (state: UserState) => void = (state: UserState) => {
const action: SetUserAction = {
type: UserActionType.SET_USER,
state
}
store.dispatch(action)
}
export const clearUser: () => void = () => {
const action: ClearUserAction = {
type: UserActionType.CLEAR_USER
}
store.dispatch(action)
}
export const getUser = (): UserState | null => {
return store.getState().user
}