mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 20:17:45 +00:00
fix(dashboard): delete accounts from unified config mode
Dashboard API DELETE /api/accounts/:name now checks both unified config (config.yaml) and legacy profiles (profiles.json) before deletion, matching CLI behavior in remove-command.ts. Fixes #455
This commit is contained in:
@@ -205,8 +205,21 @@ router.delete('/:name', (req: Request, res: Response): void => {
|
||||
return;
|
||||
}
|
||||
|
||||
// Delete the profile (legacy/unified)
|
||||
registry.deleteProfile(name);
|
||||
// Delete from appropriate config (unified and/or legacy)
|
||||
let deleted = false;
|
||||
if (isUnifiedMode() && registry.hasAccountUnified(name)) {
|
||||
registry.removeAccountUnified(name);
|
||||
deleted = true;
|
||||
}
|
||||
if (registry.hasProfile(name)) {
|
||||
registry.deleteProfile(name);
|
||||
deleted = true;
|
||||
}
|
||||
|
||||
if (!deleted) {
|
||||
res.status(404).json({ error: `Account not found: ${name}` });
|
||||
return;
|
||||
}
|
||||
|
||||
res.json({ success: true, deleted: name });
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user