added super basic JWT mockups
This commit is contained in:
@ -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>
|
||||
|
||||
|
Reference in New Issue
Block a user