Create a safe action middleware to fetch data

I actually created this and we are using it in out company's codebase and I thought I could share it with you guys, you can tell me next-safe-action does this and I'll tell you this is for fetching without having to call your getUserId() crap, and instead pass it as a middleware and return only the data you need and none of that validation errors crap, cause you only care about the returned data in fetching
No description
3 Replies
AYOUB
AYOUBOP2w ago
here is the MiddlewareContext and getUserContext() function
No description
AYOUB
AYOUBOP2w ago
No description
AYOUB
AYOUBOP2w ago
Here is an actual example of how that would look on a server side action

Did you find this page helpful?