This repository has been archived on 2024-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
mordApp/ajax.php
2021-08-13 16:38:27 +02:00

24 lines
848 B
PHP

<?php
//resend updated data
require("lib.php");
$u = use_token($_POST["sessionToken"]);
if (!$u["isStaff"]) die(json_encode(["ok" => false, "data" => []]));
$data = wrapperStaffOrders();
switch ($_POST["action"]) {
case "delete":
if (!deleteOrder($_POST["sessionToken"], $_POST["id"])) die(json_encode(["ok" => false, "data" => $data]));
$data = wrapperStaffOrders();
die(json_encode(["ok" => true, "data" => $data]));
break;
case "pay":
setPayed($_POST["sessionToken"], $_POST["id"], true);
$data = wrapperStaffOrders();
die(json_encode(["ok" => true, "data" => $data]));
break;
case "unpay":
setPayed($_POST["sessionToken"], $_POST["id"], false);
$data = wrapperStaffOrders();
die(json_encode(["ok" => true, "data" => $data]));
break;
}