diff --git a/package.json b/package.json index 48c4a43..33430e4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ipwhitelist", - "version": "0.4.2", + "version": "0.4.3", "description": "IP WhiteList microservice for cloud provider", "main": "server.js", "scripts": { diff --git a/ui/routes/entries.js b/ui/routes/entries.js index 53d264b..942e77e 100644 --- a/ui/routes/entries.js +++ b/ui/routes/entries.js @@ -37,6 +37,12 @@ function createRouter() { companies = cr.data.companies || []; const companyId = req.query.company ? parseInt(req.query.company, 10) : null; + + // Если company не выбрана — редиректим на первую в списке + if (!companyId && companies.length > 0) { + return res.redirect('/?company=' + companies[0].id); + } + selectedCompany = companyId ? companies.find(c => c.id === companyId) || null : null; if (selectedCompany) {