Problem/Motivation

The request URL is built by using ${baseUrl}${selectedEntity}/${selectedBundle}. But the actual path may be customized. For example, the Entity may be taxonomy_term and the Bundle may be categoris, but the path to the list might be customized to taxonomy/categories

Steps to reproduce

Customize the path to the API endpoint.

Proposed resolution

The proper path to the resource is listed at /jsonapi. I suspect we need to use that instead of constructing the URL from pieces in js/react-app//src/utils/urlBuilde.js

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

balsama created an issue. See original summary.

traviscarden made their first commit to this issue’s fork.

traviscarden’s picture

Status: Active » Needs review

I think ^this gets the job done, @balsama. A couple of points:

  1. This definitely preserves the existing functionality; and it seems to follow that it should work with a customized path, but I don't know how to do that (customize it) in order to test it--which, of course, makes me nervous. (It also makes me uncomfortable that we don't have a working JavaScript test suite, but that's a much bigger problem.)
  2. The application doesn't handle errors very gracefully at all--but that's a pre-existing problem that's well beyond the scope of this issue. I just thought it was worth mentioning in this context since there are a few more places in the code now for errors to occur since we're making HTTP requests and parsing responses.
  3. I added a commit to update the caniuse-lite yarn package. I know that's completely out of scope, but I got tired of seeing the warning every time I compiled. It doesn't hurt my feelings if you want to remove it from the MR.
balsama’s picture

Status: Needs review » Reviewed & tested by the community

Thanks. Tested against our sample app which customizes the paths for terms.

  • balsama committed 352e71bd on 2.0.x authored by traviscarden
    [#3545862] feat: Request URL is constructed incorrectly
    
    By: balsama
    By...
balsama’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.