use custom endpoints for customer acceptance
This commit is contained in:
@@ -23,15 +23,12 @@ const recieveCustomerAcceptance = (json) => ({
|
||||
customerAcceptance: json
|
||||
});
|
||||
|
||||
export const fetchCustomerAcceptance = (idOrder) => {
|
||||
export const fetchCustomerAcceptance = (idEntry) => {
|
||||
return dispatch => {
|
||||
dispatch(requestCustomerAcceptance());
|
||||
return htmlClient.fetch({
|
||||
url: `${API_SERVER}/orders/api/getCustomerAcceptance`,
|
||||
method: 'post',
|
||||
data: {
|
||||
idOrder
|
||||
}
|
||||
url: `${API_SERVER}/wp-json/wiaas/customer-acceptance/${idEntry}`,
|
||||
method: 'get'
|
||||
})
|
||||
.then(response => {
|
||||
if (response.data) {
|
||||
@@ -48,18 +45,15 @@ const uploadAcceptanceAction = () => ({
|
||||
type: UPLOAD_CUSTOMER_ACCEPTANCE
|
||||
});
|
||||
|
||||
export const uploadAcceptance = (idOrder, file) => {
|
||||
export const uploadAcceptance = (idEntry, file) => {
|
||||
return dispatch => {
|
||||
dispatch(uploadAcceptanceAction());
|
||||
return htmlClient.uploadFile(file, {
|
||||
url: `${API_SERVER}/orders/api/uploadAcceptanceDocument`,
|
||||
data: {
|
||||
idOrder
|
||||
}
|
||||
url: `${API_SERVER}/wp-json/wiaas/customer-acceptance/${idEntry}/upload-file`
|
||||
}).then(response => {
|
||||
if (typeof response.data !== 'undefined' && 'messages' in response.data) {
|
||||
dispatch(updateMessages(response.data.messages, orderMessages));
|
||||
dispatch(fetchCustomerAcceptance(idOrder));
|
||||
if (typeof response.data !== 'undefined') {
|
||||
//dispatch(updateMessages(response.data.messages, orderMessages));
|
||||
dispatch(fetchCustomerAcceptance(idEntry));
|
||||
}
|
||||
}).catch(error => {
|
||||
htmlClient.onError(error, dispatch);
|
||||
@@ -77,14 +71,13 @@ const sendCustomerAcceptance = () => ({
|
||||
type: SEND_CUSTOMER_ACCEPTANCE
|
||||
});
|
||||
|
||||
export const acceptDeclineInstallation = (idOrder, actionType, declineReason) => {
|
||||
export const acceptDeclineInstallation = (idEntry, actionType, declineReason) => {
|
||||
return dispatch => {
|
||||
dispatch(sendCustomerAcceptance());
|
||||
return htmlClient.fetch({
|
||||
url: `${API_SERVER}/orders/api/acceptDeclineInstallation`,
|
||||
url: `${API_SERVER}/wp-json/wiaas/customer-acceptance/${idEntry}`,
|
||||
method: 'post',
|
||||
data: {
|
||||
idOrder,
|
||||
actionType,
|
||||
declineReason
|
||||
}
|
||||
@@ -92,7 +85,7 @@ export const acceptDeclineInstallation = (idOrder, actionType, declineReason) =>
|
||||
.then(response => {
|
||||
if (response.data) {
|
||||
dispatch(updateMessages(response.data.messages, orderMessages));
|
||||
dispatch(fetchCustomerAcceptance(idOrder));
|
||||
dispatch(fetchCustomerAcceptance(idEntry));
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
|
||||
Reference in New Issue
Block a user