Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Developer1Dev/849a7bf1ddd18eef7da2d1e9007d3750 to your computer and use it in GitHub Desktop.
Save Developer1Dev/849a7bf1ddd18eef7da2d1e9007d3750 to your computer and use it in GitHub Desktop.
request(): Observable<any> {
return new Observable(observer => {
fetch(`${baseUrl}${this.url}`,{
method: this.method as any,
headers: this.headers,
body: this.body
}).then((r: any) => {
return r.json()
}).then((data: any) => {
observer.next(data);
observer.complete();
}).catch((e: any) => {
observer.error(e);})
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment