faustjs icon indicating copy to clipboard operation
faustjs copied to clipboard

Feature: Error when NEXT_PUBLIC_WORDPRESS_URL same as headless site URL

Open theodesp opened this issue 4 months ago • 1 comments

Tasks

  • [ ] I have signed a Contributor License Agreement (CLA) with WP Engine.
  • [ ] If a code change, I have written testing instructions that the whole team & outside contributors can understand.
  • [ ] I have written and included a comprehensive changeset to properly document the changes I've made.

Description

This pull request adds a check in order to alert Faust users if they accidentally set the NEXT_PUBLIC_WORDPRESS_URL to the URL of their headless site. The code now makes a request to the FaustWP endpoint and checks if the response indicates that the URL is pointing to a headless site.

Related Issue(s):

Testing

To test these changes, follow these steps:

  1. In the Faust Plugin Settings, set the Headless URL to match the NEXT_PUBLIC_WORDPRESS_URL.
  2. Try to run the dev or build commands in your headless site. Observe that it should error with the following message:
Validation Failed: Ensure your NEXT_PUBLIC_WORDPRESS_URL does not match with Headless URL in the Faust WordPress plugin settings

Screenshots

Screenshot 2024-02-21 at 13 11 29 Screenshot 2024-02-21 at 13 12 00

Documentation Changes

Dependant PRs

theodesp avatar Feb 21 '24 13:02 theodesp