aboutsummaryrefslogtreecommitdiff
path: root/controllers/list.php
diff options
context:
space:
mode:
authorSyndamia <kamen@syndamia.com>2025-02-02 13:03:31 +0200
committerSyndamia <kamen@syndamia.com>2025-02-02 13:03:31 +0200
commit26b368ecc159886ae4122d2b31e307089077f0d3 (patch)
tree3ce356dd2f784772d88e3fd5a67e65b52d193020 /controllers/list.php
parente409c1c7123dce3838d6dd1a72b4b0c2f00fba10 (diff)
downloadnowayforward_human-26b368ecc159886ae4122d2b31e307089077f0d3.tar
nowayforward_human-26b368ecc159886ae4122d2b31e307089077f0d3.tar.gz
nowayforward_human-26b368ecc159886ae4122d2b31e307089077f0d3.zip
feat(views/list): Move add item patch requests to list/add
Diffstat (limited to 'controllers/list.php')
-rw-r--r--controllers/list.php6
1 files changed, 5 insertions, 1 deletions
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);