fix(endpoints): load endpoints and tags together (#4230)

pull/4234/head
Chaim Lev-Ari 2020-08-18 15:39:32 +03:00 committed by GitHub
parent 35fa9d6981
commit 7b77a92a2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 9 deletions

View File

@ -97,20 +97,18 @@ angular
$scope.motd = data; $scope.motd = data;
}); });
getPaginatedEndpoints(0, 100).then((data) => { try {
const totalCount = data.totalCount; const [{ totalCount, endpoints }, tags] = await Promise.all([getPaginatedEndpoints(0, 100), TagService.tags()]);
$scope.tags = tags;
$scope.totalCount = totalCount; $scope.totalCount = totalCount;
if (totalCount > 100) { if (totalCount > 100) {
$scope.endpoints = []; $scope.endpoints = [];
} else { } else {
$scope.endpoints = data.endpoints; $scope.endpoints = endpoints;
} }
}); } catch (err) {
Notifications.error('Failed loading page data', err);
try {
$scope.tags = await TagService.tags();
} catch (e) {
Notifications.error('Failed loading tags', e);
} }
} }