From 837dfce94e8bbce600eca1bb341227dd4793469c Mon Sep 17 00:00:00 2001
From: remip <rpapin@grandlyon.com>
Date: Mon, 5 Oct 2020 11:14:32 +0200
Subject: [PATCH] fix for merge request

---
 src/components/Content/Content.tsx | 4 ++--
 src/models/index.ts                | 1 -
 src/services/mail.service.ts       | 7 +++++--
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/components/Content/Content.tsx b/src/components/Content/Content.tsx
index 840e5caee..c04890a8e 100644
--- a/src/components/Content/Content.tsx
+++ b/src/components/Content/Content.tsx
@@ -48,7 +48,7 @@ const Content: React.FC<ContentProps> = ({
     if (publicName) {
       username = publicName
     }
-    const bodyBienvenu = mailService.CreateBodyWelcome(
+    const bodyWelcome = mailService.CreateBodyWelcome(
       username,
       window.location.href
     )
@@ -58,7 +58,7 @@ const Content: React.FC<ContentProps> = ({
       parts: [
         {
           type: 'text/html',
-          body: bodyBienvenu,
+          body: bodyWelcome,
         },
       ],
     }
diff --git a/src/models/index.ts b/src/models/index.ts
index d86d4ffa9..88c73990f 100644
--- a/src/models/index.ts
+++ b/src/models/index.ts
@@ -7,7 +7,6 @@ export * from './ecogesture.model'
 export * from './fluid.model'
 export * from './indicator.model'
 export * from './konnector.model'
-export * from './mail.model'
 export * from './modal.model'
 export * from './timePeriod.model'
 export * from './trigger.model'
diff --git a/src/services/mail.service.ts b/src/services/mail.service.ts
index 708f306c2..ccc126c9e 100644
--- a/src/services/mail.service.ts
+++ b/src/services/mail.service.ts
@@ -1,14 +1,17 @@
 import { Client } from 'cozy-client'
 
 export default class MailService {
-  public SendMail(client: Client, mailInfo: Record<string, any>): void {
+  public async SendMail(
+    client: Client,
+    mailInfo: Record<string, any>
+  ): Promise<void> {
     try {
       const jobCollection = client.collection('io.cozy.jobs')
       jobCollection.create('sendmail', mailInfo)
-      console.log('Welcome Mail Sent')
     } catch (e) {
       // eslint-disable-next-line no-console
       console.error(e)
+      throw e
     }
   }
 
-- 
GitLab