fix: remove duplicate own company option in dropdown + bump 0.4.6

This commit is contained in:
2026-05-31 07:23:25 +03:00
parent fa67872f30
commit a355b34e4a
3 changed files with 9 additions and 9 deletions
+6 -5
View File
@@ -48,11 +48,12 @@ function createRouter() {
}
if (companyParam === 'own') {
// Собственные записи admin (getOrCreateCompany внутри API)
const er = await api.get('/api/v1/entries', token);
entries = er.data.entries || [];
limit = er.data.limit || 15;
selectedCompany = { id: 'own', name: 'Моя компания', client_id: req.user.clientId };
// Создаём/получаем компанию admin через API (getOrCreateCompany)
await api.get('/api/v1/entries', token);
// Перезагружаем список — теперь компания admin точно есть
const cr2 = await api.get('/api/v1/companies', token);
const adminCo = (cr2.data.companies || []).find(c => c.client_id === req.user.clientId);
return res.redirect('/?company=' + (adminCo ? adminCo.id : ''));
} else {
selectedCompany = companyId ? companies.find(c => c.id === companyId) || null : null;