Fix async elaborateResponse

pull/77/head
MillenniumEarl 2021-03-10 11:47:21 +01:00
parent 9ea1443074
commit b841da19c0
3 changed files with 5 additions and 7 deletions

View File

@ -158,7 +158,7 @@ export default class PlatformUser implements ILazy {
// Fetch the page
const response = await fetchHTML(url);
const result = response.applyOnSuccess(this.elaborateResponse);
const result = response.applyOnSuccess((html) => this.elaborateResponse(html));
if (result.isFailure()) throw response.value;
}

View File

@ -108,8 +108,8 @@ export default class Post implements ILazy {
const url = new URL(this.id.toString(), urls.POSTS).toString();
const response = await fetchHTML(url);
const result = response.applyOnSuccess(this.elaborateResponse);
if (result.isFailure()) throw response.value;
if (response.isSuccess()) await this.elaborateResponse(response.value);
else throw response.value;
}
//#endregion Public methods

View File

@ -244,10 +244,8 @@ export default class Thread implements ILazy {
// Fetch the HTML source
const response = await fetchHTML(this.url);
const result = response.applyOnSuccess(
async (html) => await this.elaborateResponse(html)
);
if (result.isFailure()) throw result.value;
if (response.isSuccess()) await this.elaborateResponse(response.value);
else throw response.value;
}
/**