mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-12 16:57:39 -05:00
Admin is mostly working
This commit is contained in:
42
admin/src/System/error-reducer.js
Normal file
42
admin/src/System/error-reducer.js
Normal file
@@ -0,0 +1,42 @@
|
||||
import {
|
||||
FETCH,
|
||||
FETCH_SUCCESS,
|
||||
FETCH_ERROR
|
||||
} from "./error-constants";
|
||||
|
||||
|
||||
|
||||
const error = (
|
||||
state = {
|
||||
isWaiting: false,
|
||||
items: {}
|
||||
},
|
||||
action
|
||||
) => {
|
||||
switch (action.type) {
|
||||
|
||||
case FETCH:
|
||||
|
||||
return Object.assign({}, state, { isWaiting: true});
|
||||
|
||||
|
||||
case FETCH_SUCCESS:
|
||||
return Object.assign({}, state, {
|
||||
isWaiting: false,
|
||||
items: {
|
||||
...state.items,
|
||||
[action.data.shortName]: action.data.errors
|
||||
}
|
||||
});
|
||||
|
||||
case FETCH_ERROR:
|
||||
return Object.assign({}, state, {
|
||||
isWaiting: false
|
||||
});
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
export default error;
|
||||
Reference in New Issue
Block a user