-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththeme.js
37 lines (34 loc) · 948 Bytes
/
theme.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* Copyright 2016-2021 Sourcepole AG
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
import {
THEMES_LOADED,
SET_THEME_LAYERS_LIST,
SET_CURRENT_THEME,
SWITCHING_THEME
} from '../actions/theme';
import {UrlParams} from '../utils/PermaLinkUtils';
const defaultState = {};
export default function theme(state = defaultState, action) {
switch (action.type) {
case SWITCHING_THEME: {
return {...state, switching: action.switching};
}
case THEMES_LOADED: {
return {...state, themes: action.themes};
}
case SET_THEME_LAYERS_LIST: {
return {...state, themelist: action.themelist};
}
case SET_CURRENT_THEME: {
UrlParams.updateParams({t: action.theme.id});
return {...state, current: action.theme};
}
default:
return state;
}
}