add: create, update and login dates in database
This commit is contained in:
@@ -103,6 +103,14 @@ const authConfig: SvelteKitAuthConfig = {
|
||||
signIn: '/signin'
|
||||
},
|
||||
callbacks: {
|
||||
async signIn({ user }) {
|
||||
if (user?.id) {
|
||||
await db.update(users)
|
||||
.set({ lastLogin: new Date() })
|
||||
.where(eq(users.id, user.id));
|
||||
}
|
||||
return true;
|
||||
},
|
||||
async jwt({ token, user }) {
|
||||
if (user) {
|
||||
token.id = user.id;
|
||||
|
||||
Reference in New Issue
Block a user