fix: simplify API_BASE, remove Docker SSR workaround
This commit is contained in:
parent
1d998dca55
commit
a1b58ba916
6
next-env.d.ts
vendored
Normal file
6
next-env.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/// <reference types="next" />
|
||||||
|
/// <reference types="next/image-types/global" />
|
||||||
|
/// <reference path="./.next/types/routes.d.ts" />
|
||||||
|
|
||||||
|
// NOTE: This file should not be edited
|
||||||
|
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||||
@ -1,8 +1,4 @@
|
|||||||
// SSR runs inside Docker → use internal service name; browser uses public URL
|
const API_BASE = process.env.NEXT_PUBLIC_API_URL || "http://localhost:8100";
|
||||||
const API_BASE =
|
|
||||||
typeof window === "undefined"
|
|
||||||
? (process.env.API_INTERNAL_URL || "http://tracker:8100")
|
|
||||||
: (process.env.NEXT_PUBLIC_API_URL || "http://localhost:8100");
|
|
||||||
|
|
||||||
async function request<T>(path: string, opts?: RequestInit): Promise<T> {
|
async function request<T>(path: string, opts?: RequestInit): Promise<T> {
|
||||||
const res = await fetch(`${API_BASE}${path}`, {
|
const res = await fetch(`${API_BASE}${path}`, {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user