Add Client.resetAvatar()

This commit is contained in:
Johannes Zellner
2016-01-20 17:14:50 +01:00
parent b70324aa24
commit 8d192dc992

View File

@@ -86,7 +86,9 @@ angular.module('Application').service('Client', ['$http', 'md5', 'Notification',
this._clientId = '<%= oauth.clientId %>';
this._clientSecret = '<%= oauth.clientSecret %>';
this.apiOrigin = '<%= oauth.apiOrigin %>';
this.avatar = this.apiOrigin + '/api/v1/cloudron/avatar?' + String(Math.random()).slice(2);
this.avatar = '';
this.resetAvatar();
this.setToken(localStorage.token);
}
@@ -148,6 +150,15 @@ angular.module('Application').service('Client', ['$http', 'md5', 'Notification',
callback(this._config);
};
Client.prototype.resetAvatar = function () {
this.avatar = this.apiOrigin + '/api/v1/cloudron/avatar?' + String(Math.random()).slice(2);
var favicon = $('#favicon');
console.log('rseet favicon', favicon)
if (favicon) favicon.attr('href', this.avatar);
};
Client.prototype.setUserInfo = function (userInfo) {
// In order to keep the angular bindings alive, set each property individually
this._userInfo.id = userInfo.id;