Last active
September 13, 2021 23:47
-
-
Save alshdavid/16f59c9cf2c535e1f56bf7b9ea873d32 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface IHTTPClient { | |
request(requset: Request): Promise<Response> | |
} | |
export class HTTPClient implements IHTTPClient { | |
private _fetch: window['fetch'] | |
constructor( | |
fetch: window['fetch'] | |
) { | |
this._fetch = fetch | |
} | |
request(requset: Request): Promise<Response> { | |
return this._fetch(request) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface IHTTPClient { | |
fetch(requset: Request): Promise<Response> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment