Fix async elaborateResponse
parent
9ea1443074
commit
b841da19c0
|
@ -158,7 +158,7 @@ export default class PlatformUser implements ILazy {
|
||||||
|
|
||||||
// Fetch the page
|
// Fetch the page
|
||||||
const response = await fetchHTML(url);
|
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;
|
if (result.isFailure()) throw response.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,8 +108,8 @@ export default class Post implements ILazy {
|
||||||
const url = new URL(this.id.toString(), urls.POSTS).toString();
|
const url = new URL(this.id.toString(), urls.POSTS).toString();
|
||||||
const response = await fetchHTML(url);
|
const response = await fetchHTML(url);
|
||||||
|
|
||||||
const result = response.applyOnSuccess(this.elaborateResponse);
|
if (response.isSuccess()) await this.elaborateResponse(response.value);
|
||||||
if (result.isFailure()) throw response.value;
|
else throw response.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#endregion Public methods
|
//#endregion Public methods
|
||||||
|
|
|
@ -244,10 +244,8 @@ export default class Thread implements ILazy {
|
||||||
|
|
||||||
// Fetch the HTML source
|
// Fetch the HTML source
|
||||||
const response = await fetchHTML(this.url);
|
const response = await fetchHTML(this.url);
|
||||||
const result = response.applyOnSuccess(
|
if (response.isSuccess()) await this.elaborateResponse(response.value);
|
||||||
async (html) => await this.elaborateResponse(html)
|
else throw response.value;
|
||||||
);
|
|
||||||
if (result.isFailure()) throw result.value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue