Convert uid to string for consistent comparison with session.user.id
This commit is contained in:
parent
39d971ecb6
commit
18576f43b9
2 changed files with 4 additions and 3 deletions
|
|
@ -49,7 +49,8 @@ export async function removeChat({ id, path }: { id: string; path: string }) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const uid = await kv.hget<string>(`chat:${id}`, 'userId')
|
//Convert uid to string for consistent comparison with session.user.id
|
||||||
|
const uid = String(await kv.hget(`chat:${id}`, 'userId'))
|
||||||
|
|
||||||
if (uid !== session?.user?.id) {
|
if (uid !== session?.user?.id) {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
4
auth.ts
4
auth.ts
|
|
@ -18,14 +18,14 @@ export const {
|
||||||
callbacks: {
|
callbacks: {
|
||||||
jwt({ token, profile }) {
|
jwt({ token, profile }) {
|
||||||
if (profile) {
|
if (profile) {
|
||||||
token.id = String(profile.id); // Convert profile.id to a string
|
token.id = profile.id
|
||||||
token.image = profile.avatar_url || profile.picture
|
token.image = profile.avatar_url || profile.picture
|
||||||
}
|
}
|
||||||
return token
|
return token
|
||||||
},
|
},
|
||||||
session: ({ session, token }) => {
|
session: ({ session, token }) => {
|
||||||
if (session?.user && token?.id) {
|
if (session?.user && token?.id) {
|
||||||
session.user.id = String(token.id); // Convert token.id to a string
|
session.user.id = String(token.id)
|
||||||
}
|
}
|
||||||
return session
|
return session
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue