major ui tweaks and refactoring

This commit is contained in:
Milo Schwartz 2025-01-04 20:22:01 -05:00
parent 51bf5c1408
commit 64158a823b
No known key found for this signature in database
91 changed files with 1791 additions and 1246 deletions

View file

@ -1,9 +1,9 @@
import { env } from "@app/lib/types/env";
import { Env } from "@app/lib/types/env";
import axios, { AxiosInstance } from "axios";
let apiInstance: AxiosInstance | null = null;
export function createApiClient({ env }: { env: env }): AxiosInstance {
export function createApiClient({ env }: { env: Env }): AxiosInstance {
if (apiInstance) {
return apiInstance;
}
@ -16,9 +16,9 @@ export function createApiClient({ env }: { env: env }): AxiosInstance {
let baseURL;
const suffix = "api/v1";
if (window.location.port === env.NEXT_PORT) {
if (window.location.port === env.server.nextPort) {
// this means the user is addressing the server directly
baseURL = `${window.location.protocol}//${window.location.hostname}:${env.SERVER_EXTERNAL_PORT}/${suffix}`;
baseURL = `${window.location.protocol}//${window.location.hostname}:${env.server.externalPort}/${suffix}`;
axios.defaults.withCredentials = true;
} else {
// user is accessing through a proxy