From 68d1c8f0187846dd669727ed58fc79826e020c4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B3=E5=85=83=E7=9A=93?= Date: Sat, 14 Jun 2025 21:56:50 +0800 Subject: [PATCH] Fix the var that is causing platforms to not send correctly & fix check user info everytime after you file for a change. --- components/app/windows/settings.vue | 2 ++ server/api/user/sendUserChanges.post.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/components/app/windows/settings.vue b/components/app/windows/settings.vue index 2db04b5..4f741e8 100644 --- a/components/app/windows/settings.vue +++ b/components/app/windows/settings.vue @@ -141,7 +141,9 @@ const submitChangeAction = async (action: string) => { const response = await req.json(); if (response.error) { console.error("Error updating user data:", response.error); + return; } + await validateUserInfo(); } catch (error) { console.error("Failed to submit change:", error); } diff --git a/server/api/user/sendUserChanges.post.ts b/server/api/user/sendUserChanges.post.ts index c8a683b..f25ca7c 100644 --- a/server/api/user/sendUserChanges.post.ts +++ b/server/api/user/sendUserChanges.post.ts @@ -13,7 +13,7 @@ export default defineEventHandler(async (event) => { if (body.jsonValue.length === 0) { const clearBadDataRegex = /[@-_.+a-zA-Z0-9]{2,}/; // Use Static values for now. - const requestChange = body.action; + const requestChange = body.action || ""; const apiKeyqq = body.value.match(clearBadDataRegex); const allowedColumns = ["firstname", "email"]; @@ -21,7 +21,7 @@ export default defineEventHandler(async (event) => { return { error: "ERR_NOT_ALLOWED", }; - } else if (requestChange === "name") { + } else if (requestChange === "firstname") { const sqlC = await sql` UPDATE users SET firstname = ${apiKeyqq[0]} WHERE username = ${token.user}`;