import axios from 'axios'; const httpService = axios.create({ headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Cache-Control': 'no-cache', 'Pragma': 'no-cache', 'Expires': '0', } }); httpService.interceptors.response.use( async response => response, async (error) => { console.error(`${error.request.status} (${error.request.statusText})`); return Promise.reject(error); }, ); export async function getArchive(baseUrl: string) { return await httpService.get(`https://${baseUrl}/assets/posts/archive.json`).then((res: any) => { return res.data; }); } export async function getPost(baseUrl: string, post: string) { return await httpService.get(`https://${baseUrl}/assets/posts/${post}.json`).then((res: any) => { return res.data; }); }