Skip to content

Commit

Permalink
feat: export ResponseHandler helper to use from outside of workfront-api
Browse files Browse the repository at this point in the history
  • Loading branch information
citizensas committed May 29, 2021
1 parent 49abedb commit b84fee2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Api.ts
Original file line number Diff line number Diff line change
@@ -503,7 +503,13 @@ const queryStringify = function(params) {
}, []).join('&')
}

const ResponseHandler = {
export type TSuccessHandler<T = any> = (response: any) => Promise<T>
export type TFailureHandler = (err: any) => never

export const ResponseHandler: {
success: TSuccessHandler<any>,
failure: TFailureHandler
} = {
success: (response) => {
if (response.ok) {
return response.json().then(

0 comments on commit b84fee2

Please sign in to comment.