user signin

This commit is contained in:
2026-03-18 23:52:28 +00:00
parent af075b9a24
commit 7b9c212c0e
12 changed files with 657 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
<script setup lang="ts">
import HelloWorld from './components/HelloWorld.vue'
import Login from './components/Login.vue';
</script>
<template>
<HelloWorld />
<Login />
</template>

View File

@@ -0,0 +1,28 @@
<script setup lang="ts">
import { ref } from 'vue';
const email = ref<string>("");
const pass = ref<string>("");
function login(e: SubmitEvent) {
e.preventDefault();
console.log(`${email.value} ${pass.value}`);
fetch("http://localhost:3000/login", {
method: "POST",
body: JSON.stringify({ email: email.value, pass: pass.value}),
headers: new Headers({'content-type': 'application/json'})
});
}
</script>
<template>
<form @submit="login">
<label for="email">Email</label> <br>
<input type="email" id="email" v-model="email"/> <br>
<label for="pass">Password</label> <br>
<input type="password" id="pass" v-model="pass"/> <br>
<button type="submit">Sign in</button> <br>
<button type="button">Sign up</button>
</form>
</template>

View File

@@ -1,5 +1,5 @@
import { createApp } from 'vue'
import './style.css'
// import './style.css'
import App from './App.vue'
createApp(App).mount('#app')