adminjs
Version:
Admin panel for apps written in node.js
20 lines (17 loc) • 458 B
text/typescript
import type { ThemeConfig } from '../../../adminjs-options.interface.js'
import { THEME_INITIALIZE } from '../actions/initialize-theme.js'
export type ThemeInState = (ThemeConfig & { availableThemes?: ThemeConfig[] }) | null
export const themeReducer = (
state: ThemeInState = null,
action: {
type: string
data: ThemeInState
},
) => {
switch (action.type) {
case THEME_INITIALIZE:
return action.data
default:
return state
}
}