-
-
Notifications
You must be signed in to change notification settings - Fork 168
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
feat: local provider prevent signIn flow #615
Conversation
src/runtime/types.ts
Outdated
* | ||
* @default false | ||
*/ | ||
stopLogin?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is something we only want to use for the registration flow, but adding it here, would also allow you to pass it for the signin flow. I think we need to find a way to:
- Not modify the signin options (as for registration these are then passed onto the
signIn
function - We don't want to change the order of props that can be passed (to not make breaking changes)
I think we need to either:
- Expand the
signInOptions
type by creating aregisterOptions
type with the added value - pass the value as a third optional parameter
Also lets rename it to preventLoginFlow
method, | ||
body: credentials | ||
}) | ||
|
||
if(signInOptions?.stopLogin) { | ||
return response |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not return different values based on if you want the signIn flow to happen or not, as I feel like this would lead to confusion.
@zoey-kaiser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Thanks for addressing my first review, I hope everything made sense 😊
const nuxt = useNuxtApp() | ||
|
||
const { path, method } = useTypedBackendConfig(useRuntimeConfig(), 'local').endpoints.signUp | ||
await _fetch(nuxt, path, { | ||
await _fetch<Record<string, any>>(nuxt, path, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we add types to _fetch
here? Generally speaking I am not a fan of adding any type with any
as it is pretty ambiguous.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I am not fan too.
It's a refuse coming from the previous changes, I've added just like in the n.19 line.
I'm going to delete it 🚀
@@ -105,7 +105,7 @@ const getSession: GetSessionFunc<SessionData | null | void> = async (getSessionO | |||
return data.value | |||
} | |||
|
|||
const signUp = async (credentials: Credentials, signInOptions?: SecondarySignInOptions) => { | |||
const signUp = async (credentials: Credentials, signInOptions?: SecondarySignInOptions, registerOptions?: RegisterOptions) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to bug you one last time, but lets rename all of the options from registerOptions
to signUpOptions
to be more inline with the function name and then we are good to go 🥳
Hey folks! Huge thanks to @vettndr and @zoey-kaiser for their fantastic contributions! 🌟 Any updates on when these changes will be merged? 🚀 |
Hi @root5427 👋 We generally do our updates on Mondays! You can now use this in version https://github.com/sidebase/nuxt-auth/releases/tag/0.6.4! |
@zoey-kaiser |
Closes #614.
I'm glad to discuss further improvements.
@zoey-kaiser