Skip to content

Commit

Permalink
Avoid double loader
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentTreguier committed Oct 18, 2024
1 parent b1e92f3 commit 9e21733
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/routes/settings/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,11 @@
function removeAvatar() {
return call(
async () => {
try {
isLoadingAvatar = true;
const client = await getUsersClient();
await client.deleteCurrentUserAvatar();
const client = await getUsersClient();
await client.deleteCurrentUserAvatar();
if (currentUser) {
currentUser = { ...currentUser, avatar: '' };
}
} finally {
isLoadingAvatar = false;
if (currentUser) {
currentUser = { ...currentUser, avatar: '' };
}
},
async () => new DisplayableError()
Expand Down Expand Up @@ -108,8 +103,7 @@
<td>
<Button
type="button"
disabled={!currentUser?.avatar}
loading={isLoadingAvatar}
disabled={!currentUser?.avatar || isLoadingAvatar}
on:click={removeAvatar}
>
{t('settings.profile.avatar.remove')}
Expand Down

0 comments on commit 9e21733

Please sign in to comment.