From e060cbe885a961f295fb4f6f12bc2c86b5f94192 Mon Sep 17 00:00:00 2001 From: jb-alvarado Date: Fri, 24 Nov 2023 08:11:47 +0100 Subject: [PATCH] correct add/update/delete user --- components/UserConfig.vue | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/components/UserConfig.vue b/components/UserConfig.vue index 482862a4..78ed879b 100644 --- a/components/UserConfig.vue +++ b/components/UserConfig.vue @@ -4,7 +4,7 @@

User Configuration

-
+
@@ -33,6 +33,7 @@ class="form-control" id="userName" v-model="configStore.configUser.username" + disabled />
@@ -185,7 +186,14 @@ function onChange(event: any) { } async function getUserConfig() { - await fetch(`/api/user/${selected.value}`, { + let selectUser = configStore.currentUser + + if (user.value.username) { + selectUser = user.value.username.toString() + } else if (selected.value) { + selectUser = selected.value + } + await fetch(`/api/user/${selectUser}`, { method: 'GET', headers: authStore.authHeader, }) @@ -280,6 +288,8 @@ async function onSubmitUser() { configStore.configUser.password = newPass.value } + console.log('--configStore.configUser', configStore.configUser) + authStore.inspectToken() const update = await configStore.setUserConfig(configStore.configUser)