mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-17 00:16:46 +00:00
Merge pull request #457 from kaitranntt/kai/fix/455-dashboard-delete-unified
fix(dashboard): delete accounts from unified config mode
This commit is contained in:
@@ -26,8 +26,13 @@ export async function handleShow(ctx: CommandContext, args: string[]): Promise<v
|
||||
}
|
||||
|
||||
try {
|
||||
const profile = ctx.registry.getProfile(profileName);
|
||||
const defaultProfile = ctx.registry.getDefaultProfile();
|
||||
// Use merged profiles (checks unified config first, falls back to legacy)
|
||||
const allProfiles = ctx.registry.getAllProfilesMerged();
|
||||
const profile = allProfiles[profileName];
|
||||
if (!profile) {
|
||||
exitWithError(`Profile not found: ${profileName}`, ExitCode.PROFILE_ERROR);
|
||||
}
|
||||
const defaultProfile = ctx.registry.getDefaultResolved();
|
||||
const isDefault = profileName === defaultProfile;
|
||||
const instancePath = ctx.instanceMgr.getInstancePath(profileName);
|
||||
|
||||
|
||||
@@ -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