Skip to content

v0.8.0

Compare
Choose a tag to compare
@thomasdashney thomasdashney released this 14 Apr 14:00
· 6 commits to master since this release
926fc62
  • [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)