Add initial profile background image handling
This commit is contained in:
@@ -35,6 +35,8 @@ function create() {
|
||||
result.body.isAtLeastAdmin = [ ROLES.OWNER, ROLES.ADMIN ].indexOf(result.body.role) !== -1;
|
||||
result.body.isAtLeastOwner = [ ROLES.OWNER ].indexOf(result.body.role) !== -1;
|
||||
|
||||
result.body.backgroundImageUrl = result.body.hasBackgroundImage ? `${API_ORIGIN}/api/v1/profile/background_image?access_token=${accessToken}&bustcache=${Date.now()}` : '';
|
||||
|
||||
return [null, result.body];
|
||||
},
|
||||
async setPassword(password, newPassword) {
|
||||
@@ -118,6 +120,22 @@ function create() {
|
||||
|
||||
return null;
|
||||
},
|
||||
async setBackgroundImage(file) {
|
||||
const fd = new FormData();
|
||||
if (file) fd.append('backgroundImage', file);
|
||||
|
||||
let error, result;
|
||||
try {
|
||||
result = await fetcher.post(`${API_ORIGIN}/api/v1/profile/background_image`, fd, { access_token: accessToken });
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
|
||||
if (error) return error;
|
||||
if (result.status !== 202) return result;
|
||||
|
||||
return null;
|
||||
},
|
||||
async sendPasswordReset(identifier) {
|
||||
let error, result;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user