From 26b368ecc159886ae4122d2b31e307089077f0d3 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 2 Feb 2025 13:03:31 +0200 Subject: feat(views/list): Move add item patch requests to list/add --- controllers/list.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'controllers/list.php') diff --git a/controllers/list.php b/controllers/list.php index c2e72a0..e608136 100644 --- a/controllers/list.php +++ b/controllers/list.php @@ -22,11 +22,14 @@ function on_post() { function on_patch() { global $TOKEN; global $METHOD; + global $list_status; + $list_status = ""; try { $user = Database\Cookie::fromDB($TOKEN); } catch(Exception $e) { + $list_status = "Couldn't retrieve user!"; return; } @@ -35,13 +38,14 @@ function on_patch() { $list = Database\ArchiveList::fromDB($METHOD['lid']); } catch(Exception $e) { + $list_status = "Couldn't retrieve list!"; return; } switch ($METHOD['type']) { case 'add': $list->addItem($METHOD['wid']); break; - default: throw new Exception('Unknown type ' . $METHOD['type']); + default: $list_status = 'Unknown action ' . $METHOD['type']; return; } header('Location: /list/' . $list->LID); -- cgit v1.2.3