v2: fix switch case in test API (был сломан sed-ом)
This commit is contained in:
@@ -61,6 +61,17 @@ function createTestRouter() {
|
||||
case 'limit':
|
||||
return res.json({ ok: true, limit: await q.getLimit(company) });
|
||||
|
||||
// ── SWITCH ──
|
||||
case 'switch': {
|
||||
const to = req.query.to;
|
||||
if (!to) return res.json({ ok: false, error: 'no to parameter' });
|
||||
if (!user.allClientIds.includes(to)) return res.json({ ok: false, error: 'not in allClientIds' });
|
||||
user.activeClientId = to;
|
||||
const p = user.profiles.find(p => p.client_id === to);
|
||||
if (p) { p.is_active_profile = true; user.profiles.forEach(x => { if (x !== p) x.is_active_profile = false; }); }
|
||||
return res.json({ ok: true, switchedTo: to });
|
||||
}
|
||||
|
||||
// ── CLEANUP ──
|
||||
case 'cleanup': {
|
||||
const cids = (req.query.cids || '').split(',');
|
||||
|
||||
Reference in New Issue
Block a user