From 8938ff76a0dd528bd0d4517a858365c2a76ceb5a Mon Sep 17 00:00:00 2001 From: fnuesse Date: Sun, 30 Dec 2018 21:06:23 +0100 Subject: added notification which tells the user when the fetching failed Signed-off-by: fnuesse --- js/app/directives/iconpicker.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'js/app/directives/iconpicker.js') diff --git a/js/app/directives/iconpicker.js b/js/app/directives/iconpicker.js index 185624c7..0992bc54 100644 --- a/js/app/directives/iconpicker.js +++ b/js/app/directives/iconpicker.js @@ -30,7 +30,7 @@ * # passwordGen */ angular.module('passmanApp').directive('iconPicker', [ - '$window', 'IconService', '$http', function($window, IconService, $http) { + '$window', 'IconService', '$http', 'NotificationService','$translate', function($window, IconService, $http, NotificationService, $translate) { return { templateUrl: 'views/partials/icon-picker.html', restrict: 'A', @@ -118,14 +118,12 @@ scope.refreshUrlIcon = function(){ var queryUrl = OC.generateUrl('apps/passman/api/v2/geticon/'+btoa(scope.credential.url)); $http.get(queryUrl).then(function (response) { - - scope.customIcon = {}; - scope.customIcon.data='data:image/'+response.data.type+';base64,'+response.data.content; - if (response.data) { - return response.data; - } else { - return response; - } + if(typeof response.data.content !== 'undefined'){ + scope.customIcon = {}; + scope.customIcon.data='data:image/'+response.data.type+';base64,'+response.data.content; + }else{ + NotificationService.showNotification($translate.instant('use.icon.refresh.error'), 5000); + } }); }; -- cgit v1.2.3