From 35adea9172e2ee14d6d2679930dbdcb179eaaf35 Mon Sep 17 00:00:00 2001 From: Wanderley Teixeira Date: Tue, 3 Oct 2023 13:35:48 -0300 Subject: [PATCH] feat(upload): inclui a propriedade `url` no evento `upload` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Esta melhoria permite a alteração da `url` e `headers` no evento `upload`, assim o componente fica compativel com a API de upload do Fluig conforme abaixo: `url` - Será atualizada para conter o nome do arquivo enviado; `headers` - No caso de autenticação `OAuth`, será gerado um nova `Authorization`; Fixes #1825 --- .../components/po-field/po-upload/po-upload-base.service.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/ui/src/lib/components/po-field/po-upload/po-upload-base.service.ts b/projects/ui/src/lib/components/po-field/po-upload/po-upload-base.service.ts index d0bdec922..479e569c2 100644 --- a/projects/ui/src/lib/components/po-field/po-upload/po-upload-base.service.ts +++ b/projects/ui/src/lib/components/po-field/po-upload/po-upload-base.service.ts @@ -41,7 +41,9 @@ export class PoUploadBaseService { const filesLength = files.length; const uploadEvent: any = { data: {}, - file: null + file: null, + url: url, + headers: headers }; for (let i = 0; i < filesLength; i++) { @@ -57,6 +59,8 @@ export class PoUploadBaseService { tOnUpload.emit(uploadEvent); formData.append('data', JSON.stringify(uploadEvent.data)); + url = uploadEvent.url; + headers = uploadEvent.headers; } this.sendFile(url, file, headers, formData, uploadCallback, successCallback, errorCallback);