-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Change username auth's login()
signature
#2598
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
Conversation
Whoops I by half-accident requested @infomiho here as a rewviewr but forgot it is still a draft, so probably don't do anything yet and wait for @cprecioso to give the green light! My bad. |
… of the functions
bbcf1be
to
70cdf3c
Compare
login()
signaturelogin()
signature
@infomiho ready |
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 great! I've left some refactor ideas just to clean up this part of the code base a tiny bit.
Also, let's update the Changelog
with a "Next" version (I think this will go out with 0.17.0 but let's just keep it Next for now)
@@ -2,10 +2,9 @@ | |||
import { api, handleApiError } from 'wasp/client/api' | |||
import { initSession } from './helpers/user' | |||
|
|||
export default async function login(username: string, password: string): Promise<void> { | |||
export default async function login(userFields: { username: string, password: string }): Promise<void> { |
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.
Could we make this object name same for the username & password actions as we have for the email actions (data
)? This is out of scope of this PR somewhat, but let's do some cleanup while we are here :)
@@ -2,10 +2,9 @@ | |||
import { api, handleApiError } from 'wasp/client/api' |
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.
One other refactor I'd suggest we do while we are here, is that we move the username related actions (they are quite old code) to a similar folder structure as we have for email e.g. wasp/auth/username/index.ts
+ wasp/auth/username/actions/login.ts
+ wasp/auth/username/actions/signup.ts
.
You'll need to edit some Haskell code as well, but I think it's a good learning opportunity to get to know the codebase a bit more: https://github.com/wasp-lang/wasp/blob/main/waspc/src/Wasp/Generator/SdkGenerator/Auth/LocalAuthG.hs#L30
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.
Do you mind if we do that in another PR? I'll probably need a back and forth there and it's out of scope for the current PR. Got started at #2644
@infomiho ready |
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.
Let's merge this after #2644
I already have that one on top of this one, so it's way easier to keep it like this 🙏 any specific reason to change the order? |
I misunderstood the order of branches, yeah, let's merge this and then the other PR 👍 |
Description
BREAKING CHANGE
In email auth,
wasp/client/auth
importslogin
andsignup
, each accept a single argument likelogin({email, password})
. In username authsignup
also accepts a single argumentsignup({ username, password})
. But,login
requires two different arguments likelogin(username, password)
.This PR updates it so it turns into
login({username, password})
.Select what type of change this PR introduces:
Update Waspc ChangeLog and version if needed
If you did a bug fix, new feature, or breaking change, that affects waspc, make sure you satisfy the following:
Update example apps if needed
If you did code changes and added a new feature or modified an existing feature, make sure you satisfy the following:
waspc/examples/todoApp
as needed (updated modified feature or added new feature) and manually checked it works correctly.waspc/headless-test/examples/todoApp
and its e2e tests as needed (updated modified feature and its tests or added new feature and new tests for it).