parent
c1cf3faba9
commit
b3d87186eb
@ -0,0 +1,16 @@
|
||||
import axios from "axios";
|
||||
import {GET_APPS} from "../constants/action-types";
|
||||
|
||||
export function getApps() {
|
||||
axios.post('https://localhost:9443/api/application-mgt-handler/v1.0/invoke', request
|
||||
).then(res => {
|
||||
if(res.status === 200){
|
||||
return {type: GET_APPS, payload : res.data}
|
||||
}
|
||||
|
||||
}).catch(function (error) {
|
||||
if(error.response.status === 401){
|
||||
window.location.href = 'https://localhost:9443/publisher/login';
|
||||
}
|
||||
});
|
||||
}
|
@ -1 +1,3 @@
|
||||
export const LOGIN = "LOGIN";
|
||||
export const LOGIN = "LOGIN";
|
||||
export const GET_APPS = "GET_APPS";
|
||||
|
||||
|
@ -1,8 +1,15 @@
|
||||
import {GET_APPS} from "../constants/action-types";
|
||||
|
||||
const initialState = {
|
||||
|
||||
apps : []
|
||||
};
|
||||
|
||||
function rootReducer(state = initialState, action) {
|
||||
if (action.type === GET_APPS) {
|
||||
return Object.assign({}, state, {
|
||||
apps: state.apps.concat(action.payload)
|
||||
});
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in new issue