I have a fetch call which is async of course, but I like to wrap all that in one or more functions, so the calling function doesn't bother.
This is what I have right now:
private async wrapFetch(url): Promise<void> {
this.responseText = await this.doFetch(url);
}
private async doFetch(url): Promise<string> {
return fetch(url)
.then((rsp: response) => {
return rsp.text();
});
}
Now, I would like to call wrapFetch as if it is a normal async function
this.wrapFetch('some-url');
But, this line gives the following warning:
Promise returned from wrapFetch is ignored
I've tried to change the return type from wrapFetch, but that made it worse. Any suggestions how I can fix this or should I