user signup
This commit is contained in:
@@ -6,14 +6,22 @@ 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}),
|
||||
body: JSON.stringify({ email: email.value, pass: pass.value }),
|
||||
headers: new Headers({'content-type': 'application/json'})
|
||||
});
|
||||
}
|
||||
|
||||
function signup(e: Event) {
|
||||
e.preventDefault();
|
||||
fetch("http://localhost:3000/createUser", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ email: email.value, pass: pass.value, name: email.value.split("@")[0] }),
|
||||
headers: new Headers({'content-type': 'application/json'})
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -23,6 +31,6 @@ function login(e: SubmitEvent) {
|
||||
<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>
|
||||
<button type="button" @click="signup">Sign up</button>
|
||||
</form>
|
||||
</template>
|
||||
Reference in New Issue
Block a user