Skip to content

Commit

Permalink
Kit cards on user page use information from /user (#454)
Browse files Browse the repository at this point in the history
* Kit cards on user page use information from /user

* All PreviewKit promises are fulfilled in users
  • Loading branch information
oscgonfer authored Nov 30, 2023
1 parent 1447e9c commit d40d4a0
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions src/app/components/userProfile/userProfile.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,17 @@
.then(function(user) {
vm.user = new NonAuthUser(user);

var kitIDs = _.map(vm.user.kits, 'id');
if(!kitIDs.length) {
if(!vm.user.kits.length) {
return [];
}

return $q.all(
kitIDs.map(function(id) {
return device.getDevice(id)
.then(function(data) {
return new PreviewKit(data);
});
})
);
device.createKitBlueprints().then(function(){
$q.all(vm.kits = vm.user.kits.map(function(data){
return new PreviewKit(data);
}))
})

}).then(function(kitsData){
if (kitsData){
vm.kits = kitsData;
}
}, function(error) {
}).then(function(error) {
if(error && error.status === 404) {
$location.url('/404');
}
Expand Down

0 comments on commit d40d4a0

Please sign in to comment.