Allowing user firstname and lastname to be updated through user portal.

This commit is contained in:
mike12345567 2021-07-05 09:29:16 +01:00
parent 3849d2a968
commit 57278b4532
1 changed files with 12 additions and 2 deletions

View File

@ -60,6 +60,16 @@
let toggleDisabled = false let toggleDisabled = false
async function updateUserFirstName(evt) {
await users.save({ ...$userFetch?.data, firstName: evt.target.value })
await userFetch.refresh()
}
async function updateUserLastName(evt) {
await users.save({ ...$userFetch?.data, lastName: evt.target.value })
await userFetch.refresh()
}
async function toggleFlag(flagName, detail) { async function toggleFlag(flagName, detail) {
toggleDisabled = true toggleDisabled = true
await users.save({ ...$userFetch?.data, [flagName]: { global: detail } }) await users.save({ ...$userFetch?.data, [flagName]: { global: detail } })
@ -113,11 +123,11 @@
</div> </div>
<div class="field"> <div class="field">
<Label size="L">First name</Label> <Label size="L">First name</Label>
<Input disabled thin value={$userFetch?.data?.firstName} /> <Input thin value={$userFetch?.data?.firstName} on:blur={updateUserFirstName} />
</div> </div>
<div class="field"> <div class="field">
<Label size="L">Last name</Label> <Label size="L">Last name</Label>
<Input disabled thin value={$userFetch?.data?.lastName} /> <Input thin value={$userFetch?.data?.lastName} on:blur={updateUserLastName} />
</div> </div>
<!-- don't let a user remove the privileges that let them be here --> <!-- don't let a user remove the privileges that let them be here -->
{#if userId !== $auth.user._id} {#if userId !== $auth.user._id}