ソースを参照

(fix): if not remove tag or add tag

oscar 1 年間 前
コミット
6cd992cb7a
共有1 個のファイルを変更した15 個の追加5 個の削除を含む
  1. 15
    5
      src/be/app/Http/Controllers/HealthyPassPortController.php

+ 15
- 5
src/be/app/Http/Controllers/HealthyPassPortController.php ファイルの表示

@@ -166,7 +166,6 @@ class HealthyPassPortController extends Controller
166 166
             }
167 167
             switch ($action['type']) {
168 168
                 case "addTag":
169
-                case "removeTag":
170 169
                     foreach ($action['value'] as $value) {
171 170
                         $tagType[$action['type']]['value'][] = $value;
172 171
                     }
@@ -175,10 +174,21 @@ class HealthyPassPortController extends Controller
175 174
             }
176 175
         }
177 176
 
178
-        $actions = array_merge($actions, [[
179
-            'type' => 'addTag',
180
-            'value' => $tagType['addTag']['value']
181
-        ]]);
177
+        $mergeData = [];
178
+        if (isset($tagType['addTag'])) {
179
+            $mergeData[] = [
180
+                'type' => 'addTag',
181
+                'value' => $tagType['addTag']['value']
182
+            ];
183
+        }
184
+        if (isset($tagType['removeTag'])) {
185
+            $mergeData[] = [
186
+                'type' => 'removeTag',
187
+                'value' => $tagType['removeTag']['value']
188
+            ];
189
+        }
190
+
191
+        $actions = array_merge($actions, $mergeData);
182 192
 
183 193
         $actions = array_values($actions);
184 194