Skip to content
This repository has been archived by the owner on Nov 11, 2023. It is now read-only.

Get Component fails to resolve path without RestfulProvider's base prop #159

Closed
Manishalexin opened this issue Oct 28, 2019 · 0 comments · Fixed by #160
Closed

Get Component fails to resolve path without RestfulProvider's base prop #159

Manishalexin opened this issue Oct 28, 2019 · 0 comments · Fixed by #160

Comments

@Manishalexin
Copy link
Contributor

Describe the bug
If Get Component is used without RestfulProvider top-level configuration, the path resolution adds a preceding slash to endpoints. This does not happen with the useGet method. It works as expected.
For example, the below code will result in incorrect get request of
/https://dog.ceo/api/breeds/image/random

const App = () => {
  <Get path="https://dog.ceo/api/breeds/image/random">
    {randomDogImage => (
      <img
        alt="Here's a good boye!"
        src={randomDogImage && randomDogImage.message}
      />
    )}
  </Get>;
};

To Reproduce
Steps to reproduce the behavior:

  1. Create a new React/React-Native Project
  2. yarn add restful-react
  3. Add the Get Component in your App.tsx with a url to fetch data.
  4. Check the actual fetched URL in Network tab

Reproducible Demo

Expected behavior
Even without the global configuration of RestfulProvider, Get Component should parse the right URL and fetch the data.

Screenshots
N/A

Desktop (please complete the following information):

  • OS: macOS 15.1
  • Browser : Chrome/Safari/Firefox
  • Version : 9.2.0

Smartphone (please complete the following information):
N/A

Additional context
N/A

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant