Add UI bits for setting backgroundImage

This commit is contained in:
Johannes Zellner
2022-05-14 19:41:47 +02:00
parent 41e2f7006f
commit ae0b5f010b
6 changed files with 109 additions and 1 deletions

View File

@@ -1938,6 +1938,27 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
}
};
Client.prototype.getBackgroundImageUrl = function () {
return client.apiOrigin + '/api/v1/profile/backgroundImage?access_token=' + token + '&bustcache=' + Date.now();
};
Client.prototype.setBackgroundImage = function (backgroundImage, callback) {
// Blob type if object
var fd = new FormData();
fd.append('backgroundImage', backgroundImage);
var config = {
headers: { 'Content-Type': undefined },
transformRequest: angular.identity
};
post('/api/v1/profile/backgroundImage', fd, config, function (error, data, status) {
if (error) return callback(error);
if (status !== 202) return callback(new ClientError(status, data));
callback(null);
});
};
Client.prototype.makeUserLocal = function (userId, callback) {
post('/api/v1/users/' + userId + '/make_local', {}, null, function (error, data, status) {
if (error) return callback(error);