You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.0 KiB
40 lines
1.0 KiB
import { Reducer } from 'redux'
|
|
|
|
import { ComposerActions } from '../actions/composer'
|
|
import { ComposerState } from '../types'
|
|
|
|
const initialState: ComposerState = {
|
|
installations: [],
|
|
selected: undefined,
|
|
error: undefined,
|
|
height: 100,
|
|
}
|
|
|
|
const reducer: Reducer<ComposerState, ComposerActions> = (state = initialState, action) => {
|
|
switch (action.type) {
|
|
case 'COMPOSER_SET_INSTALLATIONS':
|
|
return {
|
|
...state,
|
|
installations: action.payload,
|
|
}
|
|
case 'COMPOSER_SET_SELECTED_INSTALLATION':
|
|
return {
|
|
...state,
|
|
selected: action.payload,
|
|
}
|
|
case 'COMPOSER_SET_HEIGHT':
|
|
return {
|
|
...state,
|
|
height: action.payload,
|
|
}
|
|
case 'COMPOSER_SET_ERROR':
|
|
return {
|
|
...state,
|
|
error: action.payload,
|
|
}
|
|
default:
|
|
return state
|
|
}
|
|
}
|
|
|
|
export default reducer
|