automatically set the base url

This commit is contained in:
Milo Schwartz 2024-10-06 14:09:26 -04:00
parent 29777da430
commit 0838679120
No known key found for this signature in database
4 changed files with 40 additions and 38 deletions

View file

@ -1,7 +1,9 @@
import axios from "axios";
const baseURL = `${window.location.protocol}//${window.location.host}/api/v1`;
export const api = axios.create({
baseURL: `http://${process.env.NEXT_PUBLIC_SITE_DOMAIN || "localhost:3000"}/api/v1`,
baseURL,
timeout: 10000,
headers: {
"Content-Type": "application/json",