-
Notifications
You must be signed in to change notification settings - Fork 383
/
feedbackMask.js
40 lines (37 loc) · 1.13 KB
/
feedbackMask.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
38
39
40
/**
* Copyright 2018, GeoSolutions Sas.
* 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 {
FEEDBACK_MASK_LOADING,
FEEDBACK_MASK_LOADED,
FEEDBACK_MASK_ENABLED,
DETECTED_NEW_PAGE
} from '../actions/feedbackMask';
function feedbackMask(state = {}, action) {
switch (action.type) {
case FEEDBACK_MASK_LOADING:
return {...state, loading: true, enabled: false, status: null, errorMessage: null, mode: action.mode};
case FEEDBACK_MASK_LOADED:
return {...state, loading: false};
case FEEDBACK_MASK_ENABLED:
return {
...state,
enabled: action.enabled,
status: action.error && action.error.status,
errorMessage: action.error && action.error.messageId,
errorMessageParams: action.error && action.error.errorMessageParams
};
case DETECTED_NEW_PAGE:
return {
...state,
currentPage: action.currentPage
};
default:
return state;
}
}
export default feedbackMask;