Initial setup, not working yet
This commit is contained in:
59
frontend/items.php
Normal file
59
frontend/items.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
require_once "api/client.php";
|
||||
|
||||
$token = $_COOKIE["token"] ?? null;
|
||||
|
||||
if (!$token) {
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$items = api_request(
|
||||
"GET",
|
||||
"/item",
|
||||
null,
|
||||
$token
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Items</title>
|
||||
<link rel="stylesheet" href="assets/style.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
|
||||
<h1>Items</h1>
|
||||
|
||||
<table border="1" cellpadding="8">
|
||||
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>Unit Type</th>
|
||||
</tr>
|
||||
|
||||
<?php foreach ($items as $item): ?>
|
||||
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($item["id"]) ?></td>
|
||||
<td><?= htmlspecialchars($item["name"]) ?></td>
|
||||
<td><?= htmlspecialchars($item["unitType"]) ?></td>
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user