Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
fix(user): copy to retain the old state
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Nov 14, 2022
1 parent 4ec2272 commit 128c7cf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pages/user/read.page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,12 @@ const pageContext = inject("pageContext") as PageContext<"deserialized", Require
const { pageProps } = pageContext
const user = ref<DeserializedUserDocument<"roles"|"department">>(
pageProps.user as DeserializedUserDocument<"roles"|"department">
{
...pageProps.user,
"data": {
...pageProps.user.data
}
} as DeserializedUserDocument<"roles"|"department">
)
const roles = ref<DeserializedRoleResource[]>(
Expand Down Expand Up @@ -271,7 +276,7 @@ const textFieldStatus = ref<FieldStatus>(mayUpdateUser.value ? "enabled" : "disa
const mayNotSelect = computed<boolean>(() => !mayUpdateUser.value)
const emailVerified = computed<string>(() => {
let verifyEmail = ""
const verification = user.value.data.emailVerifiedAt !== null
const verification = user.value.data.emailVerifiedAt
if (verification) {
verifyEmail = "E-mail: Verified ✓"
} else {
Expand Down Expand Up @@ -307,6 +312,7 @@ async function updateUser() {
"prefersDark": user.value.data.prefersDark ? user.value.data.prefersDark : false
})
.then(() => {
console.log("changed email", user.value.data.emailVerifiedAt, pageProps.user.data.email, user.value.data.email)
if (user.value.data.emailVerifiedAt) {
const oldEmail = pageProps.user.data.email
const newEmail = user.value.data.email
Expand Down

0 comments on commit 128c7cf

Please sign in to comment.