Fix the var that is causing platforms to not send correctly & fix

check user info everytime after you file for a change.
This commit is contained in:
吳元皓 2025-06-14 21:56:50 +08:00
parent f1324ae0e4
commit 68d1c8f018
2 changed files with 4 additions and 2 deletions

View File

@ -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);
}

View File

@ -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}`;