feat: add system reset page and centralize API utility functions
Browse files
frontend/src/app/reset/page.tsx
CHANGED
|
@@ -25,7 +25,7 @@ export default function ResetPage() {
|
|
| 25 |
setResult(null);
|
| 26 |
|
| 27 |
try {
|
| 28 |
-
const baseUrl = process.env.NEXT_PUBLIC_API_URL || "
|
| 29 |
const resp = await fetch(`${baseUrl}/api/admin/reset-db?password=${encodeURIComponent(password)}`, {
|
| 30 |
method: "POST",
|
| 31 |
});
|
|
|
|
| 25 |
setResult(null);
|
| 26 |
|
| 27 |
try {
|
| 28 |
+
const baseUrl = process.env.NEXT_PUBLIC_API_URL || "";
|
| 29 |
const resp = await fetch(`${baseUrl}/api/admin/reset-db?password=${encodeURIComponent(password)}`, {
|
| 30 |
method: "POST",
|
| 31 |
});
|
frontend/src/lib/api.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
const API_BASE = typeof process.env.NEXT_PUBLIC_API_URL === "string"
|
| 2 |
? process.env.NEXT_PUBLIC_API_URL
|
| 3 |
-
: "
|
| 4 |
|
| 5 |
async function request<T>(path: string, options?: RequestInit): Promise<T> {
|
| 6 |
const url = path.startsWith("http") ? path : `${API_BASE}${path}`;
|
|
|
|
| 1 |
const API_BASE = typeof process.env.NEXT_PUBLIC_API_URL === "string"
|
| 2 |
? process.env.NEXT_PUBLIC_API_URL
|
| 3 |
+
: ""; // Fallback to relative paths for single-origin deployments (HF/Nginx)
|
| 4 |
|
| 5 |
async function request<T>(path: string, options?: RequestInit): Promise<T> {
|
| 6 |
const url = path.startsWith("http") ? path : `${API_BASE}${path}`;
|