-
-
Notifications
You must be signed in to change notification settings - Fork 8
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: add useAuth
composable and discriminated union for $auth
#28
feat: add useAuth
composable and discriminated union for $auth
#28
Conversation
package.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@nuxtjs/kinde", | |||
"version": "0.1.3", | |||
"version": "0.1.4", |
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.
Even though this should be a minor release based on semver 2.0
Would you provide a reproduction of the bug? 🙏 |
Co-authored-by: Daniel Roe <daniel@roe.dev>
Simply install the module with strict typescript settings and won't find the |
I think it's also worth to update the README with the newly added composable. |
src/runtime/types.ts
Outdated
export type AuthState = { | ||
loggedIn: boolean | ||
user: UserType | null | ||
} |
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 split this out in my PR also, but this type I feel is a little too open, it will allow false
with a userType
and true
with no userType
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.
Are you also solving the issue of the typing ? Adding a composable? If so for me it's ok to close this PR in favour of yours.
If we restrict the type typescript is gonna complain about "Cannot assing boolean to false" But I'll try to do it! Thanks for the warning
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.
We could totally combine the PRs, my ones exposes the kinde client so can access things like permissions, feature flags etc.
I did add a composable at one stage but it was out of scope of the change I was making was going to add later.
I get your concern about the boolean error, it would only complain about setting the boolean to false. I cannot think of a scenario where you would want false with a user. Can you think of one?
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.
PS: this is the PR I was referring to: #27
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.
Typing restricted, I don't know why the commit is not reflected.
If you want feel free to take my code in your PR and we close this one 🙂
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 looks good to me.
I'll fix issue with untyped $auth
separately.
useAuth
composable and discriminated union for $auth
just realised this wasn't opened against main; cherry-picked it in via f1f04c7. |
Issue
When using strinct type checking
$auth
is not found.Solution