Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Account update bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
revtheundead committed May 13, 2024
1 parent ba2de37 commit a8894f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion InsightioUI/insightio-ui/src/renderer/src/api/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export async function createUser(user) {
}

export async function updateUser(user) {
return instance.post(`/users/${user._id}`, user).then((res) => {
return instance.put(`/users/${user.id}`, user).then((res) => {
return res.data;
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@
})
}
const d = new Date()
const user = {
let user = {
username: username,
email: email,
password: password != '' ? await hash(password) : $userStore.password,
organizationId: $userStore.organizationId,
isAdmin: isEditMode ? $userStore.isAdmin : false,
isCreate: isEditMode ? $userStore.isCreate : true,
createdDate: isEditMode ? $userStore.createdDate : d.toISOString(),
createdBy: isEditMode ? $userStore.createdBy : $userStore._id,
createdBy: isEditMode ? $userStore.createdBy : $userStore.id,
metadata: [
{
categoryId: '660977b2e0f48cd2a2ecd01a',
Expand All @@ -66,10 +66,12 @@
}
if (isEditMode) {
user['id'] = $userStore.id
const res = await updateUser(user)
if (!('error' in res)) {
success('User successfully updated!')
resetAccountSettings()
} else {
failure('Failed to update account')
}
Expand Down

0 comments on commit a8894f1

Please sign in to comment.