maybe something to backup mealie data idk
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
597 B

3 years ago
import axios from 'axios';
import { envVars } from './config.js';
import { logger } from './utils.js';
3 years ago
3 years ago
const config = {
baseURL: envVars.BASE_URL,
headers: { authorization: `Bearer ${envVars.TOKEN}` },
3 years ago
};
const axiosWrapper = async ({
method,
url,
payload,
responseType = 'json',
}) => {
3 years ago
try {
const result = await axios({
3 years ago
method,
url,
...config,
data: { ...payload },
responseType,
});
return result;
3 years ago
} catch (error) {
logger({ type: 'error', msg: 'axios has run into trouble' });
return error;
3 years ago
}
};
export { axiosWrapper };