hedgedoc/frontend/src/redux/user/reducers.ts
Tilman Vatteroth e390c0dd15 fix(frontend): reformat source files
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2022-12-04 20:59:46 +01:00

22 lines
579 B
TypeScript

/*
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { OptionalUserState, UserActions } from './types'
import { UserActionType } from './types'
import type { Reducer } from 'redux'
export const UserReducer: Reducer<OptionalUserState, UserActions> = (
state: OptionalUserState = null,
action: UserActions
) => {
switch (action.type) {
case UserActionType.SET_USER:
return action.state
case UserActionType.CLEAR_USER:
return null
default:
return state
}
}