changed action types to single object

feature/appm-store/pbac
Jayasanka 6 years ago
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,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…
Cancel
Save