mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-20 18:25:21 -04:00
27 lines
657 B
TypeScript
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
|
|
}
|