added super basic JWT mockups

This commit is contained in:
Samuel Andert
2023-08-25 14:59:02 +02:00
parent 3ab9976ce8
commit 52a6fa3005
8 changed files with 265 additions and 3 deletions

View File

@ -1,6 +1,14 @@
<script>
import Cookies from "js-cookie";
async function login() {
alert("login");
const response = await fetch("/api/auth", { method: "POST" });
if (!response.ok) {
alert("Login failed");
} else {
let { token } = await response.json();
Cookies.set("token", token);
alert(`Login Success: ${token}`);
}
}
</script>