Revamp navigation and styling; enhance API URL handling.

Replaced `Link` components with `NavLink` for active state support and added new sidebar navigation styling. Enhanced API URL handling to prevent mixed content when using HTTPS. Updated layout and CSS for better responsiveness and consistent design.
This commit is contained in:
2026-02-12 10:07:22 +01:00
parent f12dd46c21
commit 7997773129
4 changed files with 116 additions and 11 deletions

View File

@@ -1,4 +1,21 @@
const API_URL = import.meta.env.VITE_API_URL || "http://localhost:8000/api/v1";
function resolveApiUrl() {
const raw = (import.meta.env.VITE_API_URL || "").trim();
const fallback = "/api/v1";
if (!raw) return fallback;
try {
const parsed = new URL(raw, window.location.origin);
if (window.location.protocol === "https:" && parsed.protocol === "http:") {
// Avoid mixed-content when UI is served over HTTPS.
parsed.protocol = "https:";
}
return parsed.toString().replace(/\/$/, "");
} catch {
return fallback;
}
}
const API_URL = resolveApiUrl();
export async function apiFetch(path, options = {}, tokens, onUnauthorized) {
const headers = {