Add confirmed admin override for provisioning player checks

This commit is contained in:
2026-10-05 18:16:02 -04:00
parent 4b0f341d64
commit 8abe71b915
20 changed files with 362 additions and 26 deletions
+4 -3
View File
@@ -1,4 +1,4 @@
export type ProvisioningMutation = 'resume' | 'cancel' | 'cancel-creation';
export type ProvisioningMutation = 'resume' | 'cancel' | 'cancel-creation' | 'override';
export interface ProvisioningRefreshState<T> {
id: string;
@@ -88,7 +88,7 @@ export function createProvisioningRefresh<T>(options: Options<T>) {
if (!detail) void load();
}
async function act(action: ProvisioningMutation, successMessage: string): Promise<void> {
async function act(action: ProvisioningMutation, successMessage: string, payload?: Record<string, unknown>): Promise<void> {
if (disposed || !state.id || state.busy) return;
const currentVisit = visit;
const id = state.id;
@@ -100,7 +100,8 @@ export function createProvisioningRefresh<T>(options: Options<T>) {
const timer = setTimeout(() => { timedOut = true; controller.abort(); }, options.timeoutMs ?? 15_000);
publish({ busy: action, refreshing: false, actionError: '', notice: '' });
try {
const response = await request(`/api/provisioning/${encodeURIComponent(id)}/${action}`, { method: 'POST', signal: controller.signal });
const response = await request(`/api/provisioning/${encodeURIComponent(id)}/${action}`, { method: 'POST', signal: controller.signal,
...(payload ? { headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) } : {}) });
const body = await response.json() as { error?: string };
if (!response.ok) throw new Error(body.error ?? 'The operation changed before this request could be accepted.');
if (current()) publish({ notice: successMessage });