Adding [ProducesResponseType(200)] to the controller will generate unused variable, and cause the typescript throwing the following error:
'_responseText' is declared but its value is never read.
controller:
[HttpPost("UpdateFileInfo")]
[ProducesResponseType(204)]
[ProducesResponseType(200)]
public async Task<IActionResult> UpdateFileInfo([FromBody]FileInformation fileInfo)
{
if (!await _storageService.FileExist(fileInfo.Guid))
return NoContent();
_storageService.UpdateFileInfo(fileInfo);
return Ok();
}
Generatd typescript:
protected processUpdateFileInfo(xhr: any): void | null {
const status = xhr.status;
let _headers: any = {};
if (status === 204) {
const _responseText = xhr.responseText; <======
return;
} else if (status === 200) {
const _responseText = xhr.responseText; <======
return;
} else if (status !== 200 && status !== 204) {
const _responseText = xhr.responseText;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return;
}
i am using 'JQueryPromises' template.
Any suggestions?
Thanks
This has to be fixed/improved in the TypeScript templates...
Most helpful comment
This has to be fixed/improved in the TypeScript templates...