frangeris / use-requests

Type-Safe HTTP client hook (react) to handle requests based on native fetch api with some magic under the hood ✨.
MIT License
1 stars 0 forks source link

Params followed by path are not being detected #15

Closed frangeris closed 1 week ago

frangeris commented 1 week ago

Example:

export enum Api {
  testById = "/test/:id",
  otherById = "/test/:id/other",
}

init("https://api.test.io/d", { ...Api });

const main = async () => {
  const { testById, otherById } = useRequests<typeof Api>();
  await testById.get({ params: {} });
  await otherById.get({ params: {} }); // no error here
};
main();