Services
Shared services such as Axios, Koii PoRT & utility functions. You can find more useful functions in utils/index.ts
General Structure
๐ฆservices
โฃ ๐axios
โ โ ๐index.ts
โฃ ๐port
โ โ ๐index.js
โ ๐utils
โ โ ๐index.ts
Axios
import axios from "axios";
const customAxios = axios.create({
// The base URL of your api endpoint.
baseURL: process.env.REACT_APP_BUNDLER_API_URL
});
// Global axios headers used in every single api call.
customAxios.defaults.headers.common["Content-Type"] = "application/json";
customAxios.defaults.headers.post["Content-Type"] = "application/json";
customAxios.defaults.headers.common["Access-Control-Allow-Origin"] = "*";
export default customAxios;PoRT
Utils
Last updated