hedgedoc/src/redux/banner/reducers.ts
Tilman Vatteroth 6a43d0c5fb Reorganize redux types to avoid unnecessary type casting
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2021-07-26 21:53:08 +02:00

25 lines
581 B
TypeScript

/*
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { Reducer } from 'redux'
import { BannerActions, BannerActionType, BannerState } from './types'
export const initialState: BannerState = {
text: undefined,
lastModified: null
}
export const BannerReducer: Reducer<BannerState, BannerActions> = (
state: BannerState = initialState,
action: BannerActions
) => {
switch (action.type) {
case BannerActionType.SET_BANNER:
return action.state
default:
return state
}
}