From 4ed2edecd1d70561dfbdc4367d0cb7926f94c89f Mon Sep 17 00:00:00 2001
From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com>
Date: Thu, 4 Feb 2021 18:23:30 +0100
Subject: [PATCH] fix(form) : fix update properties structure

---
 src/app/services/structure.service.ts                    | 6 +++---
 src/app/user-verification/user-verification.component.ts | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/app/services/structure.service.ts b/src/app/services/structure.service.ts
index a51c7aa85..41a02af5a 100644
--- a/src/app/services/structure.service.ts
+++ b/src/app/services/structure.service.ts
@@ -20,10 +20,10 @@ export class StructureService {
   private readonly baseUrl = 'api/structures';
   constructor(private http: HttpClient) {}
 
-  public updateStructureAfterOwnerVerify(id: string, structure: Structure): Observable<Structure> {
-    delete structure._id; // id should not be provided for update
+  public updateStructureAfterOwnerVerify(idStructure: string, user: User): Observable<any> {
+    const emailUser = user.email;
     return this.http
-      .put(`${this.baseUrl}/updateAfterOwnerVerify/${id}`, structure)
+      .put(`${this.baseUrl}/updateAfterOwnerVerify/${idStructure}`, { emailUser })
       .pipe(map((item: Structure) => new Structure(item)));
   }
   public createStructure(structure: Structure, profile: User): Observable<Structure> {
diff --git a/src/app/user-verification/user-verification.component.ts b/src/app/user-verification/user-verification.component.ts
index baa2aced4..2e97d1938 100644
--- a/src/app/user-verification/user-verification.component.ts
+++ b/src/app/user-verification/user-verification.component.ts
@@ -39,7 +39,7 @@ export class UserVerificationComponent implements OnInit {
           (structure) => {
             structure.accountVerified = true;
             this.structure = structure;
-            this.structureService.updateStructureAfterOwnerVerify(structure._id, structure).subscribe(
+            this.structureService.updateStructureAfterOwnerVerify(structure._id, user).subscribe(
               () => {
                 this.verificationSuccess = true;
               },
-- 
GitLab