Comparing version 0.1.70 to 0.1.71
@@ -16,3 +16,3 @@ "use strict"; | ||
const context = react_1.useContext(_1.FetchContext); | ||
utils_1.useURLRequiredInvariant(!!url && !!context.url, 'useDelete'); | ||
utils_1.useURLRequiredInvariant(!!url || !!context.url, 'useDelete'); | ||
const { data, loading, error, del } = _1.default(url, Object.assign({ method: types_1.HTTPMethod.DELETE }, options)); | ||
@@ -19,0 +19,0 @@ return Object.assign([data, loading, error, del], { data, loading, error, del, delete: del }); |
@@ -31,3 +31,3 @@ "use strict"; | ||
const context = react_1.useContext(FetchContext_1.default); | ||
utils_1.invariant(!!arg1 && !!context.url, 'The first argument of useFetch is required unless you have a global url setup like: <Provider url="https://example.com"></Provider>'); | ||
utils_1.invariant(!!arg1 || !!context.url, 'The first argument of useFetch is required unless you have a global url setup like: <Provider url="https://example.com"></Provider>'); | ||
let url = context.url || null; | ||
@@ -34,0 +34,0 @@ let options = {}; |
@@ -16,3 +16,3 @@ "use strict"; | ||
const context = react_1.useContext(_1.FetchContext); | ||
utils_1.useURLRequiredInvariant(!!url && !!context.url, 'useGet'); | ||
utils_1.useURLRequiredInvariant(!!url || !!context.url, 'useGet'); | ||
const { data, loading, error, get } = _1.default(url, Object.assign({ method: types_1.HTTPMethod.GET }, options)); | ||
@@ -19,0 +19,0 @@ return Object.assign([data, loading, error, get], { data, loading, error, get }); |
@@ -16,3 +16,3 @@ "use strict"; | ||
const context = react_1.useContext(_1.FetchContext); | ||
utils_1.useURLRequiredInvariant(!!url && !!context.url, 'usePatch'); | ||
utils_1.useURLRequiredInvariant(!!url || !!context.url, 'usePatch'); | ||
const { data, loading, error, patch } = _1.default(url, Object.assign({ method: types_1.HTTPMethod.PATCH }, options)); | ||
@@ -19,0 +19,0 @@ return Object.assign([data, loading, error, patch], { data, loading, error, patch }); |
@@ -16,3 +16,3 @@ "use strict"; | ||
const context = react_1.useContext(_1.FetchContext); | ||
utils_1.useURLRequiredInvariant(!!url && !!context.url, 'usePost'); | ||
utils_1.useURLRequiredInvariant(!!url || !!context.url, 'usePost'); | ||
const { data, loading, error, post } = _1.default(url, Object.assign({ method: types_1.HTTPMethod.POST }, options)); | ||
@@ -19,0 +19,0 @@ return Object.assign([data, loading, error, post], { data, loading, error, post }); |
@@ -16,3 +16,3 @@ "use strict"; | ||
const context = react_1.useContext(_1.FetchContext); | ||
utils_1.useURLRequiredInvariant(!!url && !!context.url, 'usePut'); | ||
utils_1.useURLRequiredInvariant(!!url || !!context.url, 'usePut'); | ||
const { data, loading, error, put } = _1.default(url, Object.assign({ method: types_1.HTTPMethod.PUT }, options)); | ||
@@ -19,0 +19,0 @@ return Object.assign([data, loading, error, put], { data, loading, error, put }); |
{ | ||
"name": "use-http", | ||
"version": "0.1.70", | ||
"version": "0.1.71", | ||
"homepage": "https://codesandbox.io/embed/km04k9k9x5", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -390,3 +390,3 @@ | ||
------ | ||
- [x] port to typescript | ||
- [x] typescript support | ||
- [x] badges | ||
@@ -408,3 +408,2 @@ - [X] if no url is specified, and we're in the browser, use `window.location.origin` | ||
- [ ] add array destructuring return types | ||
- [ ] github page/website for docs + show comparison with Apollo | ||
- [ ] fix code so Maintainability is A | ||
@@ -414,3 +413,8 @@ - [ ] optimize badges [see awesome badge list](https://github.com/boennemann/badges) | ||
- [ ] make GraphQL examples in codesandbox | ||
- [ ] make cool logo 😜 I kinda want it to move [like this one](https://camo.githubusercontent.com/4f6ca9438a3e45f9b409158503f3deebc86a793d/68747470733a2f2f7265626173736a732e6f72672f6c6f676f2e737667) | ||
- [ ] Documentation: | ||
- [ ] make cool logo 😜 I kinda want it to move [like this one](https://camo.githubusercontent.com/4f6ca9438a3e45f9b409158503f3deebc86a793d/68747470733a2f2f7265626173736a732e6f72672f6c6f676f2e737667) | ||
- [ ] add preview image | ||
- [ ] add google analytics | ||
- [ ] add meta tags for better searchability + open graph | ||
- [ ] show comparison with Apollo | ||
- [ ] maybe add syntax for custom headers like this | ||
@@ -427,2 +431,3 @@ ```jsx | ||
``` | ||
#### Mutations with Suspense <sup>(Not Implemented Yet)</sup> | ||
@@ -429,0 +434,0 @@ ```jsx |
61673
457