added login backend

This commit is contained in:
2025-12-08 13:27:42 +00:00
parent 3c041b1d83
commit 53c13156a2
3 changed files with 69 additions and 0 deletions

35
app/pages/login.vue Normal file
View File

@@ -0,0 +1,35 @@
<script setup lang="ts">
const { loggedIn, user, fetch: refreshSession } = useUserSession();
// create data model for the form
const credentials = reactive({
email: '',
password: '',
})
async function sendLogin() {
try {
await $fetch("/api/login", {
method: "POST",
body: credentials
})
await refreshSession()
await navigateTo('/dashboard') // user home page
} catch {
alert("Login failed.")
}
}
</script>
<template>
<UContainer class="overflow-auto">
</UContainer>
</template>
<style scoped>
</style>