mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Create change lifecycle function
This commit is contained in:
parent
c58264241b
commit
fdd9d77a47
@ -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) {
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user