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", "getList()", { url }); return new Promise((resolve, reject) => { axios.post(url, {}, { withCredentials: true, }) .then((response) => { console.log("ACTION", "edo", "getList()", "response", response.data); dispatch({ type: actionTypes.EDO_LIST, data: { list: response.data } }); resolve(); }) .catch((error) => { console.error("ACTION", "edo", "getList()", "ERROR"); console.error(error); dispatch({ type: actionTypes.EDO_LIST, data: { list: [] } }); reject(); }); }); }