-
-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BREAKING CHANGE] Switch to context based client #13
Labels
Comments
TheEdoRan
added a commit
that referenced
this issue
Jul 8, 2023
BREAKING CHANGE: `getAuthData` removed from `createOpts`; `withAuth: true` removed from action opts; use context based clients re #13
You can find and experiment with these new changes with beta version. |
🎉 This issue has been resolved in version 3.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
The current way to instantiate a new client, that supports authenticated actions is:
Then, a new action that needs auth info is defined like this:
This implementation is fine for authentication/authorization purposes, but it's extremely specific too.
There's a better, easier, and generic way to implement auth actions and anything else a user needs: context.
Using context, you can define multiple clients for different purposes. Here are two examples with a base client, and an auth one:
Then, a new action that needs auth info would be defined like this:
With context based clients, the second argument of server action function (in this case
{ userId }
), will always be the context object. If you don't define abuildContext
function while instantiating a safe action client, then context would be an empty object.The idea is to include these changes in version 3.0.0 of the library.
The text was updated successfully, but these errors were encountered: