mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
changed action types to single object
This commit is contained in:
parent
4864d5f8ec
commit
31ce3fb9d0
@ -13,6 +13,7 @@
|
||||
"acorn": "^6.1.1",
|
||||
"antd": "^3.15.0",
|
||||
"axios": "^0.18.0",
|
||||
"keymirror": "^0.1.1",
|
||||
"react": "^16.8.4",
|
||||
"react-dom": "^16.8.4",
|
||||
"react-highlight-words": "^0.16.0",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import axios from "axios";
|
||||
import {GET_APPS} from "../constants/action-types";
|
||||
import ActionTypes from "../constants/ActionTypes";
|
||||
import config from "../../../public/conf/config.json";
|
||||
|
||||
export function getApps() {
|
||||
@ -16,7 +16,7 @@ export function getApps() {
|
||||
apps = res.data.data.applications;
|
||||
}
|
||||
console.log(res.data);
|
||||
dispatch({type: GET_APPS, payload: apps});
|
||||
dispatch({type: ActionTypes.GET_APPS, payload: apps});
|
||||
}
|
||||
|
||||
}).catch(function (error) {
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
import keyMirror from 'keymirror';
|
||||
|
||||
// export const LOGIN = "LOGIN";
|
||||
// export const GET_APPS = "GET_APPS";
|
||||
// export const OPEN_RELEASES_MODAL = "OPEN_RELEASES_MODAL";
|
||||
// export const CLOSE_RELEASES_MODAL = "CLOSE_RELEASES_MODAL";
|
||||
|
||||
const ActionTypes = keyMirror({
|
||||
LOGIN: null,
|
||||
GET_APPS: null,
|
||||
OPEN_RELEASES_MODAL: null,
|
||||
CLOSE_RELEASES_MODAL: null
|
||||
|
||||
});
|
||||
|
||||
export default ActionTypes;
|
||||
@ -1,3 +0,0 @@
|
||||
export const LOGIN = "LOGIN";
|
||||
export const GET_APPS = "GET_APPS";
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import {GET_APPS} from "../constants/action-types";
|
||||
import ActionTypes from "../constants/ActionTypes";
|
||||
|
||||
const initialState = {
|
||||
apps: []
|
||||
};
|
||||
|
||||
function rootReducer(state = initialState, action) {
|
||||
if (action.type === GET_APPS) {
|
||||
if (action.type === ActionTypes.GET_APPS) {
|
||||
console.log(11);
|
||||
return Object.assign({}, state, {
|
||||
apps: action.payload
|
||||
|
||||
Loading…
Reference in New Issue
Block a user