67 lines
1.5 KiB
JavaScript
67 lines
1.5 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 { eachSeries } from 'async';
|
||
|
||
import * as actionTypes from '../constants/actionTypes';
|
||
import * as currentState from '../reducers/initialState';
|
||
|
||
export const getEDOList = ({ dispatch, update = false }) =>
|
||
{
|
||
const url = `${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/edo/list`;
|
||
|
||
console.log("ACTION", "edo", "getEDOList()", { url });
|
||
|
||
return new Promise((resolve, reject) =>
|
||
{
|
||
axios.post(url, {}, {
|
||
withCredentials: true,
|
||
})
|
||
.then((response) =>
|
||
{
|
||
console.log("ACTION", "edo", "getEDOList()", "response", response.data);
|
||
|
||
dispatch({
|
||
type: actionTypes.EDO_LIST,
|
||
data: {
|
||
list: [
|
||
{
|
||
"box_name": "ООО С К \"МОНОЛИТ-РУ\"",
|
||
"box_id": "7785f775578d4646aea1d323e703065d@diadoc.ru"
|
||
}, {
|
||
"box_name": "ООО СК \"МОНОЛИТ-РУ\" (роуминг, ООО «Такском» (Файлер))",
|
||
"box_id": "b8fbc5c395f54deabe6b8d84a10921f0@diadoc.ru"
|
||
}
|
||
]
|
||
}
|
||
});
|
||
|
||
/*
|
||
dispatch({
|
||
type: actionTypes.EDO_LIST,
|
||
data: {
|
||
list: response.data
|
||
}
|
||
});
|
||
*/
|
||
|
||
resolve();
|
||
})
|
||
.catch((error) =>
|
||
{
|
||
console.error("ACTION", "edo", "getEDOList()", "ERROR");
|
||
console.error(error);
|
||
|
||
dispatch({
|
||
type: actionTypes.EDO_LIST,
|
||
data: {
|
||
list: []
|
||
}
|
||
});
|
||
|
||
reject();
|
||
});
|
||
});
|
||
} |