[FIX] callbacks elements

This commit is contained in:
Edouard DUPIN 2024-06-12 00:54:22 +02:00
parent 2bc68321e3
commit b479414bc2
2 changed files with 8 additions and 8 deletions

View File

@ -192,7 +192,7 @@ public class TsApiGeneration {
data.append("\n\t\t\tdata,"); data.append("\n\t\t\tdata,");
} }
if (needGenerateProgress) { if (needGenerateProgress) {
data.append("\n\t\t\tcallback,"); data.append("\n\t\t\tcallbacks,");
} }
data.append("\n\t\t}: {"); data.append("\n\t\t}: {");
data.append("\n\t\trestConfig: RESTConfig,"); data.append("\n\t\trestConfig: RESTConfig,");
@ -350,7 +350,7 @@ public class TsApiGeneration {
data.append("\n\t\t\tdata,"); data.append("\n\t\t\tdata,");
} }
if (needGenerateProgress) { if (needGenerateProgress) {
data.append("\n\t\t\tcallback,"); data.append("\n\t\t\tcallbacks,");
} }
data.append("\n\t\t}"); data.append("\n\t\t}");
if (returnComplexModel != null) { if (returnComplexModel != null) {

View File

@ -237,7 +237,7 @@ export function RESTRequest({
data, data,
params, params,
queries, queries,
callback, callbacks,
}: RESTRequestType): Promise<ModelResponseHttp> { }: RESTRequestType): Promise<ModelResponseHttp> {
// Create the URL PATH: // Create the URL PATH:
let generateUrl = RESTUrl({ restModel, restConfig, data, params, queries }); let generateUrl = RESTUrl({ restModel, restConfig, data, params, queries });
@ -268,10 +268,10 @@ export function RESTRequest({
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let action: undefined | Promise<Response> = undefined; let action: undefined | Promise<Response> = undefined;
if ( if (
isNullOrUndefined(callback) || isNullOrUndefined(callbacks) ||
(isNullOrUndefined(callback.progressDownload) && (isNullOrUndefined(callbacks.progressDownload) &&
isNullOrUndefined(callback.progressUpload) && isNullOrUndefined(callbacks.progressUpload) &&
isNullOrUndefined(callback.abortHandle)) isNullOrUndefined(callbacks.abortHandle))
) { ) {
// No information needed: call the generic fetch interface // No information needed: call the generic fetch interface
action = fetch(generateUrl, { action = fetch(generateUrl, {
@ -288,7 +288,7 @@ export function RESTRequest({
headers, headers,
body, body,
}, },
callback callbacks
); );
} }
action action