Skip to content

Commit

Permalink
🏭 Add a replay() method.
Browse files Browse the repository at this point in the history
  • Loading branch information
elbywan committed Feb 23, 2019
1 parent 0573f7a commit 5af4ecc
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 35 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ const reAuthOn401 = wretch()
const token = await wretch("/renewtoken").get().text()
storeToken(token)
// Replay the original request with new credentials
return request.auth(token).get().unauthorized(err =>throw err }).json()
return request.auth(token).replay().unauthorized(err =>throw err }).json()
})

reAuthOn401.url("/resource")
Expand Down
2 changes: 1 addition & 1 deletion dist/bundle/wretch.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/bundle/wretch.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/mix.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions dist/wretcher.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ export declare class Wretcher {
* Performs an options request
*/
opts(options?: any): ResponseChain & Promise<any>;
/**
* Replay a request.
*/
replay(options?: any): ResponseChain & Promise<any>;
/**
* Sets the request body with any content.
* @param contents The body contents
Expand Down
6 changes: 6 additions & 0 deletions dist/wretcher.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/wretcher.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/mix.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const mix = function(one: object, two: object, mergeArrays: boolean = false) {
export const mix = function (one: object, two: object, mergeArrays: boolean = false) {
if(!one || !two || typeof one !== "object" || typeof two !== "object")
return one

Expand Down
Loading

0 comments on commit 5af4ecc

Please sign in to comment.