2024-10-06 12:39:05 -04:00
|
|
|
import axios from "axios";
|
|
|
|
|
2024-10-26 17:13:30 -04:00
|
|
|
let origin;
|
|
|
|
if (typeof window !== "undefined") {
|
|
|
|
origin = window.location.origin;
|
|
|
|
}
|
2024-10-26 17:01:34 -04:00
|
|
|
|
2024-10-06 12:39:05 -04:00
|
|
|
export const api = axios.create({
|
2024-10-26 17:13:30 -04:00
|
|
|
baseURL: `${origin}/api/v1`,
|
2024-10-06 22:09:30 -04:00
|
|
|
timeout: 10000,
|
|
|
|
headers: {
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2024-10-26 17:13:30 -04:00
|
|
|
// we can pull from env var here becuase it is only used in the server
|
2024-10-06 22:09:30 -04:00
|
|
|
export const internal = axios.create({
|
2024-10-26 17:13:30 -04:00
|
|
|
baseURL: `http://localhost:${process.env.SERVER_EXTERNAL_PORT}/api/v1`,
|
2024-10-06 12:39:05 -04:00
|
|
|
timeout: 10000,
|
|
|
|
headers: {
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2024-11-27 00:07:40 -05:00
|
|
|
export const priv = axios.create({
|
|
|
|
baseURL: `http://localhost:${process.env.SERVER_INTERNAL_PORT}/api/v1`,
|
|
|
|
timeout: 10000,
|
|
|
|
headers: {
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2024-10-06 12:39:05 -04:00
|
|
|
export default api;
|