2021-05-19 11:25:23 +02:00
|
|
|
<script>
|
2021-05-19 15:05:08 +02:00
|
|
|
import { ModalContent, Body, Input, notifications } from "@budibase/bbui"
|
2021-05-19 11:25:23 +02:00
|
|
|
import { writable } from "svelte/store"
|
2021-05-19 15:05:08 +02:00
|
|
|
import { auth } from "stores/portal"
|
2021-05-19 11:25:23 +02:00
|
|
|
|
|
|
|
const values = writable({
|
|
|
|
firstName: $auth.user.firstName,
|
|
|
|
lastName: $auth.user.lastName,
|
|
|
|
})
|
|
|
|
|
|
|
|
const updateInfo = async () => {
|
2021-05-19 15:05:08 +02:00
|
|
|
try {
|
2021-05-21 16:23:39 +02:00
|
|
|
await auth.updateSelf($values)
|
2021-05-19 15:05:08 +02:00
|
|
|
notifications.success("Information updated successfully")
|
|
|
|
} catch (error) {
|
|
|
|
notifications.error("Failed to update information")
|
|
|
|
}
|
2021-05-19 11:25:23 +02:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<ModalContent
|
|
|
|
title="Update user information"
|
|
|
|
confirmText="Update information"
|
|
|
|
onConfirm={updateInfo}
|
|
|
|
>
|
|
|
|
<Body size="S">
|
|
|
|
Personalise the platform by adding your first name and last name.
|
|
|
|
</Body>
|
2021-10-21 18:32:01 +02:00
|
|
|
<Input disabled bind:value={$auth.user.email} label="Email" />
|
2021-05-19 11:25:23 +02:00
|
|
|
<Input bind:value={$values.firstName} label="First name" />
|
|
|
|
<Input bind:value={$values.lastName} label="Last name" />
|
|
|
|
</ModalContent>
|