From 422ac4e4884b6c67cc959896c2c060eec8cdf676 Mon Sep 17 00:00:00 2001
From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com>
Date: Mon, 18 Jan 2021 18:08:39 +0100
Subject: [PATCH] fix(claim) : fix api parameter

---
 src/app/form/form.component.ts        | 12 +++++-------
 src/app/services/structure.service.ts |  4 ++--
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts
index 3e931beda..93ab67f33 100644
--- a/src/app/form/form.component.ts
+++ b/src/app/form/form.component.ts
@@ -253,13 +253,11 @@ export class FormComponent implements OnInit {
   }
 
   public onSubmitClaimWithAccount(): void {
-    this.structureService
-      .claimStructureWithAccount(this.structureId, this.profile.email)
-      .subscribe((structuresLinked) => {
-        this.profile.pendingStructuresLink = structuresLinked;
-        this.profileService.setProfile(this.profile);
-        this.closeEvent.emit(this.structureForm.value);
-      });
+    this.structureService.claimStructureWithAccount(this.structureId, this.profile).subscribe((structuresLinked) => {
+      this.profile.pendingStructuresLink = structuresLinked;
+      this.profileService.setProfile(this.profile);
+      this.closeEvent.emit(this.structureForm.value);
+    });
   }
   public onSubmit(structureForm: FormGroup): void {
     if (structureForm.valid) {
diff --git a/src/app/services/structure.service.ts b/src/app/services/structure.service.ts
index e28d78f8f..5b928a6a5 100644
--- a/src/app/services/structure.service.ts
+++ b/src/app/services/structure.service.ts
@@ -35,8 +35,8 @@ export class StructureService {
     return this.http.get(`${this.baseUrl}/${id}/isClaimed`);
   }
 
-  public claimStructureWithAccount(id: string, email: string): Observable<string[]> {
-    return this.http.post<any>(`${this.baseUrl}/${id}/claim`, { email });
+  public claimStructureWithAccount(id: string, user: User): Observable<string[]> {
+    return this.http.post<any>(`${this.baseUrl}/${id}/claim`, user);
   }
 
   public getStructure(id: string): Observable<Structure> {
-- 
GitLab