Fix async elaborateResponse
							parent
							
								
									9ea1443074
								
							
						
					
					
						commit
						b841da19c0
					
				| 
						 | 
				
			
			@ -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;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue