Replies: 1 comment
-
+1 on this one |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello there 👋
I created a Middleware which automatically throws on all HTTP errors.
This ensures that only 2xx requests are received directly by my client.
This currently requires me to always check if the error object in the response exists -> only then the type is narrowed down from
SomeResponseType | undefined
to justSomeResponseType
.I tried building a wrapper which removes the undefined from the return type of the GET/PUT/POST/DELETE functions, but was unsuccessful after many attempts :/
Do you have advice or is there a better way to archive this? :)
Beta Was this translation helpful? Give feedback.
All reactions