From 4d485a6bea71c97b1d34f50b2adde6dc05f26e10 Mon Sep 17 00:00:00 2001
From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com>
Date: Wed, 13 Jan 2021 14:14:56 +0100
Subject: [PATCH] fix (structurePending) : fix var name + update model

---
 src/app/form/form.component.ts              | 2 +-
 src/app/models/user.model.ts                | 1 +
 src/app/profile/services/profile.service.ts | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts
index f8fd2d78f..a5d2ff581 100644
--- a/src/app/form/form.component.ts
+++ b/src/app/form/form.component.ts
@@ -256,7 +256,7 @@ export class FormComponent implements OnInit {
     this.structureService
       .claimStructureWithAccount(this.structureId, this.profile.email)
       .subscribe((structuresLinked) => {
-        this.profile.structuresLink = structuresLinked;
+        this.profile.pendingStructuresLink = structuresLinked;
         this.profileService.setProfile(this.profile);
         this.closeEvent.emit(this.structureForm.value);
       });
diff --git a/src/app/models/user.model.ts b/src/app/models/user.model.ts
index a60ee2247..c702ff9d3 100644
--- a/src/app/models/user.model.ts
+++ b/src/app/models/user.model.ts
@@ -6,4 +6,5 @@ export class User {
   role: number;
   validationToken: string;
   structuresLink: number[];
+  pendingStructuresLink: number[];
 }
diff --git a/src/app/profile/services/profile.service.ts b/src/app/profile/services/profile.service.ts
index 760d18a8e..eba09ef41 100644
--- a/src/app/profile/services/profile.service.ts
+++ b/src/app/profile/services/profile.service.ts
@@ -40,7 +40,7 @@ export class ProfileService {
   }
 
   public createUserandLinkStructure(id: number, body: User): Observable<User> {
-    body.structuresLink = [id];
+    body.pendingStructuresLink = [id];
     return this.http.post<any>(`${this.baseUrl}`, body);
   }
 
-- 
GitLab