-
-
Notifications
You must be signed in to change notification settings - Fork 619
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
Customer authentication for v2, first PR #328
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
349717a
to
a7c453b
Compare
Looks good overall, left a few (non blocking) comments! Also, build and e2e tests are failing, but that might be an issue for a later PR. We should update the e2e GH Action to work with v2. |
import { redirect } from "next/navigation" | ||
import { cache } from "react" | ||
|
||
// Note: For some weird reason the response is SOMETIMES a promise here... does it get called like a server action? Investigate. |
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.
Probably due to the "use server"
directive. When it's called from a client component, it will be converted into an endpoint. Maybe we could move getAuthHeaders
to a separate file and use import "server-only"
[source] to prevent this behaviour.
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.
@VariableVic what I would have expected is that, since all the methods that call getAuthHeaders
are server actions, this method should just be a normal function call on the server. I'll try your suggestion and see if that fixes it.
return {} | ||
} | ||
|
||
export const getCustomer = cache(async function () { |
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 we still need to wrap these in React Cache? Isn't the new js sdk based on fetch instead of Axios? Not blocking but worth looking into. We can also decide to wait until Next 15 is out, as they're changing the default fetch caching behaviour.
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.
@VariableVic probably not, I just kept it as it was. There is a lot of cleanup to be done, which we can do in a separate iteration, I just want to make everything v2 compatible for now 😄
@VariableVic there is still quite a bit of work to be done, once this PR, and another one that I'll open later today are merged, I'll start to do more thorough testing and fixes, and at that point I think we can also look into the tests |
This PR enables the basic interactions with a customer and the auth setup.
A follow-up PR will add all the address-related endpoints, and then we'll do a full e2e test.