Activities of "RobWiebkin"

Hi

Currently PageAlertContainerComponent unforunatly doesn't support html content rendering for both basic and lepton theme. I created an issue for this request.

Thanks for that. I assume this limitation is also present in LeptonX?

Please use IRemoteStreamContent

See https://github.com/abpframework/abp/blob/c86d8406c82ac0281df19374ceb336edfaa661ba/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentTestController.cs#L15-L20

Hi liangshiwei, I've updated my code using the IRemoteStreamContent (see below), however generated method is still execting to parse the response as JSON unless I manually update the responseType.

Updated Code:

[HttpGet]
[Route("entry/export/csv")]
public async Task<IRemoteStreamContent> GetTimeEntryExportCSV(Guid[] ids)
{
    var bytes = await _fileExportAppService.GetTimeEntryExportCSV(ids);
    var memoryStream = new MemoryStream();
    await memoryStream.WriteAsync(bytes);
    memoryStream.Position = 0;
    return new RemoteStreamContent(memoryStream, "exported-time.csv");
}

Generated proxy:

getTimeEntryExportCSVByIds = (ids: string[]) =>
    this.restService.request<any, IRemoteStreamContent>({
      method: 'GET',
      url: '/api/timetracker-service/entry/export/csv',
      params: { ids },
    },
    { apiName: this.apiName });

Calling code:

this.timeTrackerService.getTimeEntryExportCSVByIds(stringOfIds)
      .subscribe(fileResponse => {
        console.group({fileResponse})
        const a = document.createElement('a');
        a.href = URL.createObjectURL(fileResponse);
        a.download = "exported-time" + moment().format("yyyyMMDDHHmmss") + ".csv";
        a.click();
      }, error => { console.log({error}) });

The error is: SyntaxError: Unexpected token P in JSON at position 0 at JSON.parse (<anonymous>) at XMLHttpRequest.o (http://localhost:4200/main.js:1:239492) at e.invokeTask (http://localhost:4200/polyfills.js:1:160868) at Object.onInvokeTask (http://localhost:4200/main.js:1:360127) at e.invokeTask (http://localhost:4200/polyfills.js:1:160789) at t.runTask (http://localhost:4200/polyfills.js:1:155947) at t.invokeTask [as invoke] (http://localhost:4200/polyfills.js:1:162000) at v (http://localhost:4200/polyfills.js:1:174611) at XMLHttpRequest.m (http://localhost:4200/polyfills.js:1:174917)

With the message: "Http failure during parsing for https://localhost:44325/api/timetracker-service/entry/export/csv?ids=39fff254-296b-4ce2-1498-c4b52e02c0db"

Showing 1 to 2 of 2 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11