Skip to content

Return response on failed requests #610

@oliviertassinari

Description

@oliviertassinari

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Summary 💡

When an API request is not OK

https://github.com/mui/mui-toolpad/blob/479def38e5a01f23aac7da8bb90f33f78e49fe9d/packages/toolpad-app/src/toolpadDataSources/rest/server.ts#L60

It only logs the error:

Screenshot 2022-06-25 at 16 19 56

However, it's not helpful. I would expect something like this (Postman):

Screenshot 2022-06-25 at 16 25 08

https://mui-org.postman.co/workspace/Team-Workspace~a3fd1430-e7a2-482a-8fa2-e4f40a2223c8/request/19543436-85f9898b-a606-4caa-ad96-cb46ba1257ea

or

Screenshot 2022-06-25 at 16 21 24

Examples 🌈

To reproduce

  1. open https://master--toolpad.mui.com/_toolpad/app/cl1c2j0l512939zo6a43575en/editor/pages/cl4tz0p6600083b6ed912vgvf
  2. open the "query"
  3. Run the preview button

For context, it calls https://app.goflightlabs.com/flights

Motivation 🔦

I had to run the project locally to add a console.log to understand what was going wrong. Ideas for follow-ups:

  1. The port 3000 locally conflicts with Material-UI's docs, maybe to use a different one, https://www.notion.so/mui-org/Ports-b113d0d4c76c4db9a0ef99c703d0084c?
  2. Arguably, seeing the request, similar to the Chrome/Firefox Dev Tools would have helped too. I would have realized that I didn't use the UI correctly.
  3. I thought that the "Parameters" were URL query parameters but not at all, they are meant to be used to create dynamic queries. So maybe it would be great to add a new URL query params section. It would be easier to use than building the URL, enforcing that the URL syntax (&, ? =) is correct. Then we could rename "Parameters" to be clearer, and these URL query params could optionally use "Parameters" when we want the query to be reused.

Metadata

Metadata

Assignees

No one assigned

    Labels

    design: uxRelated to End-users' experience.feature: QueriesMaking new API requestsscope: toolpad-studioAbbreviated to "studio"type: new featureExpand the scope of the product to solve a new problem.waiting for 👍Waiting for upvotes. Open for community feedback and needs more interest to be worked on.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions