roles update

This commit is contained in:
lendry
2026-06-25 15:14:50 +03:00
parent 9671fe458b
commit 1c55c871fc
21 changed files with 721 additions and 93 deletions

View File

@@ -133,6 +133,19 @@ export default function AdminOAuthPage() {
}
}
async function handleDeleteClient(client: OAuthClient) {
if (!token) return;
if (!window.confirm(`Удалить приложение «${client.name}»? Это действие необратимо.`)) return;
try {
await apiFetch(`/admin/rbac/oauth-clients/${client.clientId}`, { method: 'DELETE' }, token);
showToast('Приложение удалено');
setSelectedClient(null);
await loadData();
} catch (error) {
showToast(error instanceof Error ? error.message : 'Не удалось удалить приложение');
}
}
function copyText(value: string, label: string) {
void navigator.clipboard.writeText(value);
showToast(`${label} скопирован`);
@@ -213,6 +226,7 @@ export default function AdminOAuthPage() {
onCopy={copyText}
onRotateSecret={(clientId) => void handleRotateSecret(clientId)}
onToggleActive={(client) => void handleToggleActive(client)}
onDelete={(client) => void handleDeleteClient(client)}
/>
<Dialog open={dialogOpen} onOpenChange={setDialogOpen}>