Przeglądaj źródła

(fix): if not remove tag or add tag

oscar 1 rok temu
rodzic
commit
6cd992cb7a

+ 15
- 5
src/be/app/Http/Controllers/HealthyPassPortController.php Wyświetl plik

166
             }
166
             }
167
             switch ($action['type']) {
167
             switch ($action['type']) {
168
                 case "addTag":
168
                 case "addTag":
169
-                case "removeTag":
170
                     foreach ($action['value'] as $value) {
169
                     foreach ($action['value'] as $value) {
171
                         $tagType[$action['type']]['value'][] = $value;
170
                         $tagType[$action['type']]['value'][] = $value;
172
                     }
171
                     }
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
         $actions = array_values($actions);
193
         $actions = array_values($actions);
184
 
194