From bd939c0e21d16786b2cc0675c7a1cdfaa9520446 Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Mon, 11 Mar 2019 17:30:44 +0100
Subject: [PATCH] fix unlock

---
 .../app/actions/actions-list.component.ts     | 47 ++++++++++++-------
 1 file changed, 30 insertions(+), 17 deletions(-)

diff --git a/src/frontend/app/actions/actions-list.component.ts b/src/frontend/app/actions/actions-list.component.ts
index b9c9e2e6404..617ca7eabc7 100644
--- a/src/frontend/app/actions/actions-list.component.ts
+++ b/src/frontend/app/actions/actions-list.component.ts
@@ -119,11 +119,12 @@ export class ActionsListComponent implements OnInit {
             }
         });
         dialogRef.afterClosed().subscribe(result => {
+            this.unlock();
             
             if (result == 'success') {
                 this.endAction();
             } else {
-                this.unlock();
+                this.unlockRest();
             }
         });
     }
@@ -140,11 +141,12 @@ export class ActionsListComponent implements OnInit {
             }
         });
         dialogRef.afterClosed().subscribe(result => {
-
+            this.unlock();
+            
             if (result == 'success') {
                 this.endAction();
             } else {
-                this.unlock();
+                this.unlockRest();
             }
         });
     }
@@ -161,11 +163,12 @@ export class ActionsListComponent implements OnInit {
             }
         });
         dialogRef.afterClosed().subscribe(result => {
-
+            this.unlock();
+            
             if (result == 'success') {
                 this.endAction();
             } else {
-                this.unlock();
+                this.unlockRest();
             }
         });
     }
@@ -182,11 +185,12 @@ export class ActionsListComponent implements OnInit {
             }
         });
         dialogRef.afterClosed().subscribe(result => {
-
+            this.unlock();
+            
             if (result == 'success') {
                 this.endAction();
             } else {
-                this.unlock();
+                this.unlockRest();
             }
         });
     }
@@ -203,11 +207,12 @@ export class ActionsListComponent implements OnInit {
             }
         });
         dialogRef.afterClosed().subscribe(result => {
-
+            this.unlock();
+            
             if (result == 'success') {
                 this.endAction();
             } else {
-                this.unlock();
+                this.unlockRest();
             }
         });
     }
@@ -224,11 +229,12 @@ export class ActionsListComponent implements OnInit {
             }
         });
         dialogRef.afterClosed().subscribe(result => {
-
+            this.unlock();
+            
             if (result == 'success') {
                 this.endAction();
             } else {
-                this.unlock();
+                this.unlockRest();
             }
         });
     }
@@ -245,11 +251,12 @@ export class ActionsListComponent implements OnInit {
             }
         });
         dialogRef.afterClosed().subscribe(result => {
-
+            this.unlock();
+            
             if (result == 'success') {
                 this.endAction();
             } else {
-                this.unlock();
+                this.unlockRest();
             }
         });
     }
@@ -266,11 +273,12 @@ export class ActionsListComponent implements OnInit {
             }
         });
         dialogRef.afterClosed().subscribe(result => {
-
+            this.unlock();
+            
             if (result == 'success') {
                 this.endAction();
             } else {
-                this.unlock();
+                this.unlockRest();
             }
         });
     }
@@ -287,11 +295,12 @@ export class ActionsListComponent implements OnInit {
             }
         });
         dialogRef.afterClosed().subscribe(result => {
+            this.unlock();
 
             if (result == 'success') {
                 this.endAction();
             } else {
-                this.unlock();
+                this.unlockRest();
             }
         });
     }
@@ -320,11 +329,12 @@ export class ActionsListComponent implements OnInit {
             }
         });
         dialogRef.afterClosed().subscribe(result => {
+            this.unlock();
 
             if (result == 'success') {
                 this.endAction();
             } else {
-                this.unlock();
+                this.unlockRest();
             }
         });
     }
@@ -392,6 +402,9 @@ export class ActionsListComponent implements OnInit {
 
     unlock() {
         clearInterval(this.currentLock);
+    }
+
+    unlockRest() {
         this.http.put('../../rest/resourcesList/users/' + this.currentBasketInfo.ownerId + '/groups/' + this.currentBasketInfo.groupId + '/baskets/' + this.currentBasketInfo.basketId + '/unlock', { resources: this.arrRes })
             .subscribe((data: any) => { }, (err: any) => { });
     }
-- 
GitLab