1
0
mirror of https://github.com/pocket-id/pocket-id.git synced 2026-02-15 15:10:08 +00:00

feat(profile-picture): allow reset of profile picture (#355)

Co-authored-by: Elias Schneider <login@eliasschneider.com>
This commit is contained in:
Kyle Mendell
2025-03-18 14:59:31 -05:00
committed by GitHub
parent a0f93bda49
commit 8f146188d5
6 changed files with 156 additions and 31 deletions

View File

@@ -26,6 +26,15 @@
const userService = new UserService();
const webauthnService = new WebAuthnService();
async function resetProfilePicture() {
await userService
.resetCurrentUserProfilePicture()
.then(() =>
toast.success('Profile picture has been reset. It may take a few minutes to update.')
)
.catch(axiosErrorToast);
}
async function updateAccount(user: UserCreate) {
let success = true;
await userService
@@ -42,7 +51,9 @@
async function updateProfilePicture(image: File) {
await userService
.updateCurrentUsersProfilePicture(image)
.then(() => toast.success('Profile picture updated successfully'))
.then(() =>
toast.success('Profile picture updated successfully. It may take a few minutes to update.')
)
.catch(axiosErrorToast);
}
@@ -101,7 +112,8 @@
<ProfilePictureSettings
userId={account.id}
isLdapUser={!!account.ldapId}
callback={updateProfilePicture}
updateCallback={updateProfilePicture}
resetCallback={resetProfilePicture}
/>
</Card.Content>
</Card.Root>

View File

@@ -58,7 +58,14 @@
async function updateProfilePicture(image: File) {
await userService
.updateProfilePicture(user.id, image)
.then(() => toast.success('Profile picture updated successfully'))
.then(() => toast.success('Profile picture updated successfully. It may take a few minutes to update.'))
.catch(axiosErrorToast);
}
async function resetProfilePicture() {
await userService
.resetProfilePicture(user.id)
.then(() => toast.success('Profile picture has been reset. It may take a few minutes to update.'))
.catch(axiosErrorToast);
}
</script>
@@ -89,7 +96,8 @@
<ProfilePictureSettings
userId={user.id}
isLdapUser={!!user.ldapId}
callback={updateProfilePicture}
updateCallback={updateProfilePicture}
resetCallback={resetProfilePicture}
/>
</Card.Content>
</Card.Root>