fix login and create logout

fix login to login by email password
This commit is contained in:
NekoVari 2023-11-18 18:06:27 +07:00
parent 19b4d18941
commit 48e29ee9fd
3 changed files with 795 additions and 7 deletions

View file

@ -12,8 +12,8 @@
<div class="mx-5">
<v-text-field
class="username"
v-model="input.username"
class="email"
v-model="input.email"
label="อีเมล"
variant="solo"
>
@ -85,14 +85,14 @@ export default {
return {
pageTitle: 'ลงชื่อเข้าใช้',
input: {
username: '',
email: '',
password: ''
}
};
},
methods: {
login() {
if (this.input.username !== '' && this.input.password !== '') {
if (this.input.email !== '' && this.input.password !== '') {
console.log('Authenticated: Checking with Backend');
fetch(`https://little-lines-backend.techtransthai.org/api/users/login`, {
method: "POST",
@ -100,7 +100,7 @@ export default {
"Content-Type": "application/json",
},
body: JSON.stringify({
username: this.input.username,
email: this.input.email,
password: this.input.password,
}),
})
@ -121,7 +121,7 @@ export default {
// Handle the error, e.g., display an error message to the user
});
} else {
console.log('Username and Password cannot be empty');
console.log('Email and Password cannot be empty');
}
}
}