This repository has been archived by the owner on Feb 27, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #398
Description
Display the error message in the login or registration page via state instead of redirecting to the same page with the error message in the url.
Error messages for registration are from backend, see WebDevStudios/wds-headless-wordpress#27.
Login error messages are defined here in the front end. Unlike registration, WP GraphQL sends back the error code instead of error message in
login()
mutation. I tried looking for a filter which can be used to filter the response on login and the closest I can find is graphql_request_results but when I tried to use this filter it proved rather hard to change response from error code to actual message. So for now, the error message are defined in the front end. My concern to this solution is internationalization which can be discussed/addressed in another ticket.Links
Login - https://nextjs-wordpress-starter-d74djk0x5-webdevstudios.vercel.app/login
Registration - https://nextjs-wordpress-starter-d74djk0x5-webdevstudios.vercel.app/register
Screenshot
Verification
How will a stakeholder test this?
Note
This PR should be merged for the registration error messages to display properly.