This commit is contained in:
2025-11-23 00:11:18 +01:00
parent 014f489857
commit 85afff2c19
12 changed files with 34 additions and 179 deletions
+1 -4
View File
@@ -40,7 +40,7 @@ interface UseApiTokensResult {
const useApiTokens = ({ notifyApiError, setStatusMessage, token }: UseApiTokensArgs): UseApiTokensResult => {
const [tokens, setTokens] = useState<ApiTokenRecord[]>([]);
const [loading, setLoading] = useState(false);
const [loading] = useState(false);
const [creating, setCreating] = useState(false);
const [deletingId, setDeletingId] = useState<string | number | null>(null);
const [regeneratingId, setRegeneratingId] = useState<string | number | null>(null);
@@ -50,14 +50,11 @@ const useApiTokens = ({ notifyApiError, setStatusMessage, token }: UseApiTokensA
if (!token) {
return;
}
setLoading(true);
try {
const data = await listApiTokens();
setTokens(Array.isArray(data) ? data : []);
} catch (error) {
notifyApiError?.(error, 'Failed to load API tokens.');
} finally {
setLoading(false);
}
}, [notifyApiError, token]);