evoleasing-account/actions/dealsActions.js
2023-08-28 10:08:19 +03:00

49 lines
1.1 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";
/*
/lk/ConsiderationOpportunity/quote
[{
"quote_number": "582189",
"price": 5490000,
"first_payment_perc": 30,
"first_payment_rub": 1647000,
"brand_name": "Volkswagen",
"model_name": "Touareg",
"object_count": 1,
}, {
"quote_number": "580008",
"price": 5341770,
"first_payment_perc": 30,
"first_payment_rub": 1647000,
"brand_name": "Volkswagen",
"model_name": "Touareg",
"object_count": 1,
}]
*/
export const getDeals = ({ dispatch }) =>
{
//console.log("ACTION", "support", "getAppeals()", `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/support/appeals`);
return new Promise((resolve, reject) =>
{
axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/deals/list`, {}, {
withCredentials: true,
})
.then((response) =>
{
//console.log("ACTION", "support", "getAppeals()", "response", response.data);
dispatch({ type: actionTypes.DEALS, data: {} });
resolve();
})
.catch((error) =>
{
console.error(error);
reject();
});
});
}