diff --git a/src/routes/console/[project]/users/user/[user]/index.svelte b/src/routes/console/[project]/users/user/[user]/index.svelte index 13139ff44..d1398cc7f 100644 --- a/src/routes/console/[project]/users/user/[user]/index.svelte +++ b/src/routes/console/[project]/users/user/[user]/index.svelte @@ -3,7 +3,14 @@ import { toLocaleDate } from '$lib/helpers/date'; import { Avatar, CardGrid, Box, DropList, DropListItem } from '$lib/components'; import { Pill } from '$lib/elements'; - import { Button, InputText, InputEmail, InputPassword, Helper } from '$lib/elements/forms'; + import { + Button, + InputText, + InputEmail, + InputPassword, + InputPhone, + Helper + } from '$lib/elements/forms'; import { Container } from '$lib/layout'; import { sdkForProject } from '$lib/stores/sdk'; import { addNotification } from '$lib/stores/notifications'; @@ -19,11 +26,12 @@ } } let showDelete = false; - let showError: false | 'name' | 'email' | 'password' = false; + let showError: false | 'name' | 'email' | 'phone' | 'password' = false; let errorMessage = 'Something went wrong'; let errorType: 'error' | 'warning' | 'success' = 'error'; let userName: string = null, userEmail: string = null, + userPhone: string = null, newPassword: string = null, newPref = false, newKey: string = null, @@ -129,6 +137,20 @@ addError('email', error.message, 'error'); } } + async function updatePhone() { + try { + await sdkForProject.users.updatePhone($user.response.$id, userPhone); + $user.response.phone = userPhone; + userPhone = null; + showError = false; + addNotification({ + message: 'Phone has been updated', + type: 'success' + }); + } catch (error) { + addError('phone', error.message, 'error'); + } + } async function updatePassword() { try { await sdkForProject.users.updatePassword($user.response.$id, newPassword); @@ -303,6 +325,30 @@ }}>Update + +
Update Phone
+ + + + + + + +
Update Password