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 b64296dea97..f4604d847ec 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 @@ -23,7 +23,6 @@ export const getApps = () => dispatch => { } }); - }; export const getRelease = (uuid) => dispatch => { @@ -87,3 +86,24 @@ export const getLifecycle = ()=> dispatch =>{ } }); }; + + +export const updateLifecycleState = (uuid, nextState) => dispatch => { + + const request = "method=get&content-type=application/json&payload={}&api-endpoint=/applications/lifecycle-config/"+uuid+"?action="+nextState; + + return axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request + ).then(res => { + if (res.status === 200) { + let release = res.data.data; + dispatch({type: ActionTypes.GET_RELEASE, payload: release}); + } + + }).catch(function (error) { + if (error.response.status === 401) { + window.location.href = 'https://localhost:9443/publisher/login'; + } + }); + + +}; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/constants/ActionTypes.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/constants/ActionTypes.js index cf9dd0f39f1..76ec0da9f7f 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/constants/ActionTypes.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/js/constants/ActionTypes.js @@ -8,7 +8,8 @@ const ActionTypes = keyMirror({ GET_RELEASE: null, GET_LIFECYCLE: null, OPEN_LIFECYCLE_MODAL: null, - CLOSE_LIFECYCLE_MODAL: null + CLOSE_LIFECYCLE_MODAL: null, + UPDATE_LIFECYCLE_STATE: null, }); export default ActionTypes; \ No newline at end of file