ui(api): add useDirtyState + apply=staged|live on useUpdateApplicationConfig

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-22 22:45:42 +02:00
parent 6052975750
commit 52ff385b04
2 changed files with 30 additions and 2 deletions

View File

@@ -203,3 +203,27 @@ export function usePromoteDeployment() {
onSuccess: () => qc.invalidateQueries({ queryKey: ['apps'] }),
});
}
// --- Dirty State ---
export interface DirtyStateDifference {
field: string;
staged: string;
deployed: string;
}
export interface DirtyState {
dirty: boolean;
lastSuccessfulDeploymentId: string | null;
differences: DirtyStateDifference[];
}
export function useDirtyState(envSlug: string | undefined, appSlug: string | undefined) {
return useQuery({
queryKey: ['apps', envSlug, appSlug, 'dirty-state'],
queryFn: () => apiFetch<DirtyState>(
`${envBase(envSlug!)}/${encodeURIComponent(appSlug!)}/dirty-state`,
),
enabled: !!envSlug && !!appSlug,
});
}