75 lines
1.9 KiB
JavaScript
75 lines
1.9 KiB
JavaScript
import axios from 'axios';
|
|
import { Cookies } from 'react-cookie';
|
|
import Router from 'next/router';
|
|
import moment from 'moment';
|
|
import { nSQL } from "@nano-sql/core";
|
|
import { concatSeries, eachSeries } from 'async';
|
|
|
|
import * as actionTypes from '../constants/actionTypes';
|
|
import * as currentState from '../reducers/initialState';
|
|
|
|
export const signCheckEDOCreatePrintForm = ({ contracts, sign_type }) =>
|
|
{
|
|
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/sign/check`;
|
|
|
|
console.log("ACTION", "edo", "signCheckEDOCreatePrintForm()", { url });
|
|
|
|
return new Promise((resolve, reject) =>
|
|
{
|
|
concatSeries(contracts, (contract_id, callback) =>
|
|
{
|
|
axios.post(url, { contract_number: contract_id, sign_type }, {
|
|
withCredentials: true,
|
|
})
|
|
.then((response) =>
|
|
{
|
|
console.log("ACTION", "edo", "signCheckEDOCreatePrintForm()", "response", response.data);
|
|
|
|
callback(response.data);
|
|
})
|
|
.catch((error) =>
|
|
{
|
|
console.error("ACTION", "edo", "signCheckEDOCreatePrintForm()", "ERROR");
|
|
console.error(error);
|
|
|
|
callback(error.data);
|
|
});
|
|
}, (error, result) =>
|
|
{
|
|
resolve(result);
|
|
})
|
|
});
|
|
}
|
|
|
|
export const signGetGUIDEntity = ({ contract_number }) =>
|
|
{
|
|
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/sign/entity`;
|
|
|
|
console.log("ACTION", "edo", "signGetGUIDEntity()", { url });
|
|
|
|
return new Promise((resolve, reject) =>
|
|
{
|
|
concatSeries(contracts, (contract_id, callback) =>
|
|
{
|
|
axios.post(url, { contract_number: contract_id, sign_type }, {
|
|
withCredentials: true,
|
|
})
|
|
.then((response) =>
|
|
{
|
|
console.log("ACTION", "edo", "signGetGUIDEntity()", "response", response.data);
|
|
|
|
callback(response.data);
|
|
})
|
|
.catch((error) =>
|
|
{
|
|
console.error("ACTION", "edo", "signGetGUIDEntity()", "ERROR");
|
|
console.error(error);
|
|
|
|
callback(error.data);
|
|
});
|
|
}, (error, result) =>
|
|
{
|
|
resolve(result);
|
|
})
|
|
});
|
|
} |