fix: remove duplicate own company option in dropdown + bump 0.4.6
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user