From 74c1fac979d6d1949f9065a8f4c7559ba8b2d4e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFs=20Mansot?= <26844641+devfull@users.noreply.github.com> Date: Tue, 26 Sep 2023 11:08:13 +0200 Subject: [PATCH] update filename of download --- src/front/Api/BaseApiService.ts | 2 +- .../Notary/OfficeFolderAnchors/OfficeFolderAnchors.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/front/Api/BaseApiService.ts b/src/front/Api/BaseApiService.ts index b1648452..dfa17f91 100644 --- a/src/front/Api/BaseApiService.ts +++ b/src/front/Api/BaseApiService.ts @@ -134,7 +134,7 @@ export default abstract class BaseApiService { const anchor = document.createElement("a"); anchor.href = url; - anchor.download = filename ?? uuid(); + anchor.download = filename ?? `${uuid()}.pdf`; anchor.click(); URL.revokeObjectURL(url); diff --git a/src/front/Api/LeCoffreApi/Notary/OfficeFolderAnchors/OfficeFolderAnchors.ts b/src/front/Api/LeCoffreApi/Notary/OfficeFolderAnchors/OfficeFolderAnchors.ts index d56e7f46..24cab51f 100644 --- a/src/front/Api/LeCoffreApi/Notary/OfficeFolderAnchors/OfficeFolderAnchors.ts +++ b/src/front/Api/LeCoffreApi/Notary/OfficeFolderAnchors/OfficeFolderAnchors.ts @@ -42,9 +42,8 @@ export default class OfficeFolderAnchors extends BaseNotary { public async download(uid: string): Promise { const url = new URL(this.baseURl.concat(`/download/${uid}`)); try { - return await this.getRequest(url, undefined, ContentType.PDF, "attestation.pdf"); + return await this.getRequest(url, undefined, ContentType.PDF, `${uid}.pdf`); } catch (err) { - console.log("ERROR: ", err); this.onError(err); return Promise.reject(err); }