mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 13:04:23 +00:00
Fix validateUserToken w/ fetching data from the main users table.
This commit is contained in:
parent
1f02ad8486
commit
ea2d7688b1
1 changed files with 8 additions and 3 deletions
|
@ -30,6 +30,11 @@ export default defineEventHandler(async (event) => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getUserInfo = await sql`
|
||||||
|
SELECT * FROM users
|
||||||
|
WHERE username = ${fetchViaSQL[0].username}
|
||||||
|
`;
|
||||||
|
|
||||||
const tokenDate = new Date(fetchViaSQL[0].created_at);
|
const tokenDate = new Date(fetchViaSQL[0].created_at);
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const dayInMilliseconds = 24 * 60 * 60 * 1000;
|
const dayInMilliseconds = 24 * 60 * 60 * 1000;
|
||||||
|
@ -43,10 +48,10 @@ export default defineEventHandler(async (event) => {
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
userAccount: fetchViaSQL[0].username,
|
userAccount: fetchViaSQL[0].username,
|
||||||
firstName: fetchViaSQL[0].firstName,
|
firstName: getUserInfo[0].firstName || "",
|
||||||
requested_action: "CONTINUE",
|
requested_action: "CONTINUE",
|
||||||
current_spot: "KEEP_LOGIN",
|
current_spot: "KEEP_LOGIN",
|
||||||
email: fetchViaSQL[0].email,
|
email: getUserInfo[0].email || "",
|
||||||
avatarURL: fetchViaSQL[0].avatarurl,
|
avatarURL: getUserInfo[0].avatarurl || "",
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue