Files
nexus/frontend/src/services/api.ts
T
devops ac131f7f53 feat: Parent-Child TaskFlow — Delegated durch sichtbare Child-Tasks ersetzt
- Delegated State aus Board, Entities, DTOs, Frontend-Spalten und Tests entfernt
- Parent-Tasks bleiben InProgress waehrend delegierter Agentenarbeit
- Child-Tasks laufen sichtbar mit normalen States und parentTaskId
- Doku: README, Phase 3, Changelog, Controller-Kommentare angepasst
- openclaw-task-board-flow.md als Referenzdoku hinzugefuegt
- 73/73 Backend-Tests gruen, Frontend-Build gruen
2026-06-21 21:30:52 +02:00

27 lines
842 B
TypeScript

import { useAuthStore } from '../stores/auth'
export async function apiFetch(input: RequestInfo | URL, init: RequestInit = {}) {
const auth = useAuthStore()
if (!auth.initialized) await auth.initialize()
const send = () => {
const headers = new Headers(init.headers)
if (auth.accessToken) headers.set('Authorization', `Bearer ${auth.accessToken}`)
if (auth.isIris) headers.set('X-Agent-Id', 'iris')
else if (auth.isBao) headers.set('X-Agent-Id', 'bao')
return fetch(input, { ...init, headers, credentials: 'include' })
}
let response = await send()
if (response.status !== 401) return response
const refreshed = await auth.refresh()
if (!refreshed) {
if (window.location.pathname !== '/login') window.location.assign('/login')
return response
}
response = await send()
return response
}