Auth: added
This commit is contained in:
@@ -1,15 +1,34 @@
|
||||
<script setup>
|
||||
import FormBase from '@/components/FormBase.vue'
|
||||
import router from '@/router'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<form>
|
||||
<input type="email" placeholder="Email">
|
||||
<input type="password" placeholder="Password">
|
||||
<button>Log in</button>
|
||||
</form>
|
||||
<form>
|
||||
<label for="email">Email:</label>
|
||||
<input type="email" id="email" v-model="email" placeholder="Email" />
|
||||
<label for="password">Password:</label>
|
||||
<input type="password" id="password" v-model="password" placeholder="Password" />
|
||||
<button @click.prevent="formAction">Log in</button>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
<script>
|
||||
import User from '@/api/user'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
email: '',
|
||||
password: ''
|
||||
}
|
||||
</style>
|
||||
},
|
||||
methods: {
|
||||
async formAction() {
|
||||
const status = await User.loginUser({ email: this.email, password: this.password })
|
||||
if (status.code == 200) {
|
||||
throw router.push('/')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@@ -1,3 +1,14 @@
|
||||
<script setup>
|
||||
import FormBase from '@/components/FormBase.vue'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<b>signup</b>
|
||||
</template>
|
||||
<FormBase btn-txt="Signup" api-endpoint="/user/signup">
|
||||
<label for="username">Username:</label>
|
||||
<input type="text" id="username" placeholder="Username" />
|
||||
<label for="email">Email:</label>
|
||||
<input type="email" id="email" placeholder="Email" />
|
||||
<label for="password">Password:</label>
|
||||
<input type="password" id="password" placeholder="Password" />
|
||||
</FormBase>
|
||||
</template>
|
||||
|
Reference in New Issue
Block a user