import axios from "axios"; const post = async (path, data, onError) => { return axios.post(`${import.meta.env.VITE_API_ADDR}${path}`, data) .then(r => r.data) .catch(error => { onError && onError(error) console.error('Error post request:', error) }) } /** * * @param {String} path * @returns {Promise | void>} */ const get = async (path) => { return axios.get(`${import.meta.env.VITE_API_ADDR}${path}`) .catch(error => { console.error('Error post request:', error) }) } /** * * @param {Object} data * @param {Function} onError * @returns {Promise | void>} */ const scand_post = async (data, onError) => { return axios.post(`${import.meta.env.VITE_SCAND_API_URL}`, data) .then(r => r.data) .catch(error => { onError && onError(error) console.error('Error post request:', error) }) } export {get, post, scand_post}