Import drizzle replacing prisma

Signed-off-by: Arthur DANJOU <arthurdanjou@outlook.fr>
This commit is contained in:
2024-04-20 00:03:10 +02:00
parent a7f0a635ec
commit c6ba8c791b
108 changed files with 2367 additions and 1554 deletions

View File

@@ -0,0 +1,19 @@
export default oauth.githubEventHandler({
config: {
emailRequired: true
},
async onSuccess(event, {user}) {
await setUserSession(event, {
user: {
email: user.email,
picture: user.avatar_url,
username: String(user.name).trim(),
admin: user.email === process.env.NUXT_AUTH_ADMIN_EMAIL
}
})
return sendRedirect(event, getCookie(event, 'last-route') || '/')
},
onError(error) {
console.error('GitHub OAuth error:', error)
}
})