Advertisement
Guest User

Untitled

a guest
Feb 27th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //log a user in with a username/password
  2.     login: function(username, password) {
  3.       return self.$http.post(envConfig.auth.login, { username: username, password: password })
  4.         .then(setupUser)
  5.         .catch(function(resp) {
  6.           if (angular.isString(resp)) {
  7.             return $q.reject(resp);
  8.           }
  9.  
  10.           if (resp.status === 401) {
  11.             return $q.reject('bad-password');
  12.           }
  13.  
  14.           var msg = utilityService.stringFormat('<p>Service Error: {0} </p><p> Status Code: {1} </p><p> URL: {2}</p>',
  15.             (resp.data || {}).error || 'Unknown',
  16.             resp.status,
  17.             resp.config.url
  18.           );
  19.           aaNotify.danger(msg,
  20.             { iconClass: 'zmdi zmdi-mood-bad zmdi-hc-5x', ttl: 0, allowHtml: true, showClose: true });
  21.  
  22.           return $q.reject(resp);
  23.         });
  24.     },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement