v2: fix switch case in test API (был сломан sed-ом)
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
// ═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
module.exports = {
|
||||
version: '0.5.83',
|
||||
version: '0.5.84',
|
||||
iamUrl: process.env.V2_IAM_API_URL || 'https://auth-api.ngcloud.ru',
|
||||
appUrl: process.env.V2_APP_URL || 'https://whitelist.nodejsk8s.services.ngcloud.ru',
|
||||
};
|
||||
|
||||
@@ -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