diff --git a/src/app/admin/settings/tabs/ApiTab/ApiTab.tsx b/src/app/admin/settings/tabs/ApiTab/ApiTab.tsx index f57bfb0..30508d8 100644 --- a/src/app/admin/settings/tabs/ApiTab/ApiTab.tsx +++ b/src/app/admin/settings/tabs/ApiTab/ApiTab.tsx @@ -47,9 +47,9 @@ export function ApiTab() { const extraBody: Record = {}; if (newTokenUserId) extraBody.userId = newTokenUserId; if (newTokenRole) extraBody.role = newTokenRole; - await api.handleCreate(extraBody); - // Reset admin-specific fields on success - if (!api.error) { + const created = await api.handleCreate(extraBody); + // Reset admin-specific fields only when create succeeds + if (created) { setNewTokenUserId(''); setNewTokenRole(''); } @@ -123,10 +123,12 @@ export function ApiTab() { -