Skip to content

Commit

Permalink
Final: Enhanced App Backend (3 coms)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangsonww committed Feb 9, 2025
1 parent 277322e commit eb0a3fc
Show file tree
Hide file tree
Showing 2 changed files with 570 additions and 425 deletions.
31 changes: 31 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,37 @@
gtag('config', 'G-CQKJ67FXZ4');
</script>
<body>
<script>
async function login(email, password) {
try {
const response = await fetch(
"https://api-movieverse.vercel.app/auth/login",
{
method: "POST",
headers: {
Accept: "*/*",
"Content-Type": "application/json",
},
body: JSON.stringify({ email, password }),
},
);

if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}

const data = await response.json();

if (data.token) {
localStorage.setItem("movieverseToken", data.token);
} else {
console.log("Login failed:", data.message);
}
} catch (error) {
console.log("Error logging in:", error);
}
}
</script>
<header id="homepage-header" style="margin-bottom: -10px">
<h1 id="my-heading" style="margin-bottom: -25px" class="notranslate">
<a id="indexLink" href="#" style="text-decoration: none; color: inherit; cursor: pointer">
Expand Down
Loading

0 comments on commit eb0a3fc

Please sign in to comment.