diff --git a/src/scripts/classes/mapping/platform-user.ts b/src/scripts/classes/mapping/platform-user.ts index 3e2d127..0817805 100644 --- a/src/scripts/classes/mapping/platform-user.ts +++ b/src/scripts/classes/mapping/platform-user.ts @@ -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; } diff --git a/src/scripts/classes/mapping/post.ts b/src/scripts/classes/mapping/post.ts index 57b992b..1d3f59c 100644 --- a/src/scripts/classes/mapping/post.ts +++ b/src/scripts/classes/mapping/post.ts @@ -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 diff --git a/src/scripts/classes/mapping/thread.ts b/src/scripts/classes/mapping/thread.ts index ca583c1..5ea3d43 100644 --- a/src/scripts/classes/mapping/thread.ts +++ b/src/scripts/classes/mapping/thread.ts @@ -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; } /**