Run additional code on user creation
I want to run additional code on user creation, how do I achieve this?
Solution:Jump to solution
Is that api you are importing from client or server? It looks like you are using useMutation, which is a react hook. You want to use the api from the server
7 Replies
Events | NextAuth.js
Events are asynchronous functions that do not return a response, they are useful for audit logs / reporting or handling any other side-effects.
auth.ts
So something like this should work?
![No description](https://cdn.answeroverflow.com/1165286563782074468/image.png)
Because it doesn't xD
The user still gets created like normal but the added code is disregarded
Do you want AFTER user creation, or before?
Solution
Is that api you are importing from client or server? It looks like you are using useMutation, which is a react hook. You want to use the api from the server
Yep, I was using a react hook so it didn't work