From 7584c3a04df4a828360b9545e3133307f3484e84 Mon Sep 17 00:00:00 2001 From: Gregoire Parant Date: Wed, 23 Sep 2020 18:44:24 +0200 Subject: [PATCH] Fix CI --- .../ConsoleGlobalMessageManager.ts | 26 ++++++++++++------- .../Administration/GlobalMessageManager.ts | 2 +- front/src/Connection.ts | 2 +- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/front/src/Administration/ConsoleGlobalMessageManager.ts b/front/src/Administration/ConsoleGlobalMessageManager.ts index 69f4a3ad..7de1af40 100644 --- a/front/src/Administration/ConsoleGlobalMessageManager.ts +++ b/front/src/Administration/ConsoleGlobalMessageManager.ts @@ -35,7 +35,9 @@ export class ConsoleGlobalMessageManager { initialise() { try { HtmlUtils.removeElementByIdOrFail(CLASS_CONSOLE_MESSAGE); - }catch (err){} + }catch (err){ + console.error(err); + } const typeConsole = document.createElement('input'); typeConsole.id = INPUT_TYPE_CONSOLE; @@ -169,11 +171,11 @@ export class ConsoleGlobalMessageManager { const input = document.createElement('input'); input.type = 'file'; input.id = UPLOAD_CONSOLE_MESSAGE - input.addEventListener('input', (e: any) => { + input.addEventListener('input', (e: Event) => { if(!e.target || !e.target.files || e.target.files.length === 0){ return; } - let file : File = e.target.files[0]; + const file : File = e.target.files[0]; if(!file){ return; @@ -181,7 +183,9 @@ export class ConsoleGlobalMessageManager { try { HtmlUtils.removeElementByIdOrFail('audi-message-filename'); - }catch (e) {} + }catch (err) { + console.error(err) + } const p = document.createElement('p'); p.id = 'audi-message-filename'; @@ -223,12 +227,12 @@ export class ConsoleGlobalMessageManager { } private sendTextMessage(){ - let elements = document.getElementsByClassName('ql-editor'); - let quillEditor = elements.item(0); + const elements = document.getElementsByClassName('ql-editor'); + const quillEditor = elements.item(0); if(!quillEditor){ throw "Error get quill node"; } - let GlobalMessage : GlobalMessageInterface = { + const GlobalMessage : GlobalMessageInterface = { id: 1, message: quillEditor.innerHTML, type: MESSAGE_TYPE @@ -246,9 +250,9 @@ export class ConsoleGlobalMessageManager { const fd = new FormData(); fd.append('file', selectedFile); - let res = await this.Connection.uploadAudio(fd); + const res = await this.Connection.uploadAudio(fd); - let GlobalMessage : GlobalMessageInterface = { + const GlobalMessage : GlobalMessageInterface = { id: res.id, message: res.path, type: AUDIO_TYPE @@ -256,7 +260,9 @@ export class ConsoleGlobalMessageManager { inputAudio.value = ''; try { HtmlUtils.removeElementByIdOrFail('audi-message-filename'); - }catch (e) {} + }catch (err) { + console.error(err); + } this.Connection.emitGlobalMessage(GlobalMessage); } diff --git a/front/src/Administration/GlobalMessageManager.ts b/front/src/Administration/GlobalMessageManager.ts index e2850bff..0b75d4be 100644 --- a/front/src/Administration/GlobalMessageManager.ts +++ b/front/src/Administration/GlobalMessageManager.ts @@ -25,7 +25,7 @@ export class GlobalMessageManager { } private playMessage(message : GlobalMessageInterface){ - let previousMessage = document.getElementById(this.getHtmlMessageId(message.id)); + const previousMessage = document.getElementById(this.getHtmlMessageId(message.id)); if(previousMessage){ previousMessage.remove(); } diff --git a/front/src/Connection.ts b/front/src/Connection.ts index 66a133f3..dd8540bf 100644 --- a/front/src/Connection.ts +++ b/front/src/Connection.ts @@ -200,7 +200,7 @@ export class Connection implements Connection { } public uploadAudio(file : FormData){ - return Axios.post(`${API_URL}/upload-audio-message`, file).then((res: any) => { + return Axios.post(`${API_URL}/upload-audio-message`, file).then((res: {data:{}}) => { return res.data; }).catch((err) => { console.error(err);