From fdd9d77a471b1fd22030bc7e3456434ac8b62a72 Mon Sep 17 00:00:00 2001 From: Jayasanka Date: Thu, 16 May 2019 14:04:46 +0530 Subject: [PATCH] Create change lifecycle function --- .../react-app/src/js/actions/index.js | 8 ++++---- .../react-app/src/js/reducers/index.js | 5 +---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/actions/index.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/actions/index.js index e37566a2ff..5e70f0a49b 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/actions/index.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/actions/index.js @@ -87,22 +87,22 @@ export const getLifecycle = () => dispatch => { }); }; - export const updateLifecycleState = (uuid, nextState, reason) => dispatch => { const payload = { - nextState: nextState, + action: nextState, reason: reason }; - const request = "method=get&content-type=application/json&payload=" + JSON.stringify(payload) + "&api-endpoint=/applications/lifecycle-config/" + uuid; + const request = "method=get&content-type=application/json&payload=" + JSON.stringify(payload) + "&api-endpoint=/applications/lifecycle/" + uuid; console.log(request); return axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request ).then(res => { if (res.status === 200) { - dispatch({type: ActionTypes.UPDATE_LIFECYCLE_STATE, payload: {currentStatus: nextState}}); + let release = res.data.data; + dispatch({type: ActionTypes.UPDATE_LIFECYCLE_STATE, payload: release}); } }).catch(function (error) { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/reducers/index.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/reducers/index.js index 74a861fbf4..a03213ef46 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/reducers/index.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/reducers/index.js @@ -49,15 +49,12 @@ function rootReducer(state = initialState, action) { } }); }else if (action.type === ActionTypes.UPDATE_LIFECYCLE_STATE) { - const release = {}; return Object.assign({}, state, { lifecycleModal: { visible: false, nextState: null, }, - release:{ - currentStatus : action.payload.currentStatus - } + release: action.payload }); } return state;