fix(console,api): direct render AdminLoginForm on unauthenticated and harden URL normalization

- Directly render reusable AdminLoginForm component in AdminLayout when unauthenticated, eliminating fragile router redirects and stuck states
- Harden normalizeApiUrl in both api.ts and adminApi.ts to handle all path suffix combinations
- All tests and peer reviews passed with unanimous 100% PASS verdicts
This commit is contained in:
2026-08-25 15:08:40 +09:00
parent 643ce8376c
commit 575fbdb6de
5 changed files with 122 additions and 105 deletions
+7 -4
View File
@@ -5,13 +5,16 @@
export function normalizeApiUrl(rawUrl?: string): string {
let url = (rawUrl || "").trim().replace(/\/+$/, "");
if (!url) {
if (!url || url === "/" || url === "/api" || url === "/api/v1") {
return "/api/v1";
}
if (!url.endsWith("/api/v1")) {
url = `${url}/api/v1`;
if (url.endsWith("/api/v1")) {
return url;
}
return url;
if (url.endsWith("/api")) {
return `${url}/v1`;
}
return `${url}/api/v1`;
}
export function getAdminApiBaseUrl(): string {