Releases
v0.8.0
[breaking] Uses observables
instead of event emitters (#44 ). onError
must be written like this now:
const subscription = api . onError . subscribe ( error => {
// handle error
} )
subscription . unsubscribe ( )
[breaking] Default useApiQuery#refetch
to use deduplicate: false
(#49 )
[breaking] Removes withApi
(#44 )
[feature] Adds useMutation
hook (#48 )
const [ createUser , { mutating : creatingUser } ] = useApiMutation ( {
mutation : ( firstName : string , lastName : string ) => async ( api ) => {
return api . request ( UserEndpoints . create ( { firstName, lastName} ) )
} ,
onError : ( error ) => console . error ( error ) ,
onSuccess : ( user ) => console . log ( `Created user ${ firstName } ` )
} )
// usage
createUser ( 'Thomas' , 'Dashney' )
[feature] Adds basic server-side rendering support by removing Headers
, Request
, and Response
dependencies. All it needs is a fetch
polypill now (#44 )
[bugfix] Fixes bug where content-type: application/json; charset=utf8
is not parsed as JSON (#31 )
You can’t perform that action at this time.