correct put call to not remove password 😅

This commit is contained in:
kevmodrome 2020-06-29 15:55:12 +02:00
parent 7c2b5e1858
commit eec2c4de7c
2 changed files with 9 additions and 7 deletions

View File

@ -9,7 +9,7 @@
<div class="inputs"> <div class="inputs">
<Input <Input
disabled={!editMode} disabled
thin thin
bind:value={user.username} bind:value={user.username}
name="Name" name="Name"

View File

@ -66,8 +66,10 @@ exports.create = async function(ctx) {
exports.update = async function (ctx) { exports.update = async function (ctx) {
const db = new CouchDB(ctx.user.instanceId) const db = new CouchDB(ctx.user.instanceId)
const user = ctx.request.body const user = ctx.request.body
const dbUser = db.get(ctx.request.body._id)
const newData = { ...dbUser, ...user }
const response = await db.put(user) const response = await db.put(newData)
user._rev = response.rev user._rev = response.rev
ctx.status = 200 ctx.status = 200