auth: SSOログイン後の画面遷移とユーザー表示を修正

- コールバック成功時のリダイレクト先をWEB_ORIGINルートから
  /dashboardに変更(ランディングで止まらないように)
- ルートページでログイン済みならダッシュボードへ自動遷移
- サイドバーのユーザーカードをOIDC identityの表示名・メールに変更し、
  未ログイン時のみSSOログインリンクを表示
- demoヘッダ(x-demo-user)はdemoモード時のみ送信
This commit is contained in:
amania-jailbreak
2026-08-05 16:07:10 +09:00
parent 03440d269d
commit f9ce4b218e
4 changed files with 39 additions and 5 deletions
+3 -1
View File
@@ -41,7 +41,9 @@ export async function api<T>(path: string, init: RequestInit = {}) {
const headers = new Headers(init.headers);
headers.set("accept", "application/json");
if (init.body) headers.set("content-type", "application/json");
Object.entries(DEMO_HEADERS).forEach(([key, value]) => headers.set(key, value));
if (AUTH_MODE === "demo") {
Object.entries(DEMO_HEADERS).forEach(([key, value]) => headers.set(key, value));
}
const response = await fetch(`${API_BASE}${path}`, { ...init, headers, credentials: "include" });
const body = (await response.json().catch(() => ({}))) as T & { error?: string; detail?: string };
if (!response.ok) throw new Error(body.detail || body.error || `Request failed (${response.status})`);