profiles: serializers representation to parse avatar url

This commit is contained in:
AdrienLSH
2024-04-07 15:50:36 +02:00
parent 51f8dfcaa3
commit 13a078eb82
8 changed files with 123 additions and 127 deletions

View File

@ -25,10 +25,8 @@ class MyProfile extends Profile
const response = await this.client._patch_file(`/api/profiles/settings`, formData);
const responseData = await response.json();
if (response.ok) {
this.avatar = responseData.avatar.substr(responseData.avatar.indexOf('static') - 1);
if (response.ok)
return null;
}
return responseData;
}
@ -36,10 +34,8 @@ class MyProfile extends Profile
const response = await this.client._delete('/api/profiles/settings');
const responseData = await response.json();
if (response.ok) {
this.avatar = responseData.avatar.substr(responseData.avatar.indexOf('static') - 1);
if (response.ok)
return null;
}
return responseData;
}