Fix provider configuration response rendering
CI / verify (push) Has been cancelled
CI / publish (push) Has been cancelled

Align the admin page with the array response defined by the production API and OpenAPI contract so successful status loads cannot trip the route error boundary.
This commit is contained in:
Rocky
2026-08-22 17:21:20 +08:00
parent 10ba4f0a0c
commit 636a8541bc
3 changed files with 17 additions and 21 deletions
+1 -3
View File
@@ -135,9 +135,7 @@ export interface ManagedProviderStatus {
updatedAt?: string;
}
export interface ManagedProviderOverview {
providers: ManagedProviderStatus[];
}
export type ManagedProviderOverview = ManagedProviderStatus[];
export interface UpdateProviderApiKeyRequest {
apiKey: string;
@@ -59,10 +59,10 @@ export function ProvidersPage() {
const updateStatus = useCallback((updated: ManagedProviderStatus) => {
setOverview((current) => {
if (!current) return current;
const providers = current.providers.filter(
const providers = current.filter(
(item) => item.providerId !== updated.providerId,
);
return { providers: [...providers, updated] };
return [...providers, updated];
});
}, []);
@@ -101,7 +101,7 @@ export function ProvidersPage() {
providerId={provider.id}
name={provider.name}
description={provider.description}
status={overview.providers.find((item) => item.providerId === provider.id)}
status={overview.find((item) => item.providerId === provider.id)}
onUpdated={updateStatus}
/>
))}
+2 -4
View File
@@ -66,8 +66,7 @@ function mockProviders() {
}
function providerOverview(): ManagedProviderOverview {
return {
providers: [
return [
{
providerId: "deepseek",
configured: true,
@@ -79,6 +78,5 @@ function providerOverview(): ManagedProviderOverview {
configured: true,
source: "ENVIRONMENT",
},
],
};
];
}