mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
fix userid serialization due to bigint format bug
This commit is contained in:
parent
9e16205696
commit
3e2905a6dd
2 changed files with 3 additions and 4 deletions
|
|
@ -36,7 +36,6 @@ export const AuthOptions: NextAuthOptions = {
|
|||
if (user === null || user.email === null) {
|
||||
return "/beta";
|
||||
}
|
||||
|
||||
const dbUser: User[] = await db
|
||||
.select()
|
||||
.from(userTable)
|
||||
|
|
@ -65,8 +64,8 @@ export const AuthOptions: NextAuthOptions = {
|
|||
}
|
||||
|
||||
// Set the user's ID from your database
|
||||
user.dbId = dbUser[0].id;
|
||||
|
||||
// Because bigint isn't serializable, we need to convert it to a string
|
||||
user.dbId = dbUser[0].id.toString();
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error("Error during sign-in: ", error);
|
||||
|
|
|
|||
2
src/types/next-auth.d.ts
vendored
2
src/types/next-auth.d.ts
vendored
|
|
@ -9,6 +9,6 @@ declare module "next-auth" {
|
|||
} & DefaultSession["user"];
|
||||
}
|
||||
interface User {
|
||||
dbId: bigint;
|
||||
dbId: string;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue