Frontend: signup added
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
<script setup>
|
||||
import FormBase from '@/components/FormBase.vue'
|
||||
import router from '@/router'
|
||||
</script>
|
||||
|
||||
|
@ -1,14 +1,36 @@
|
||||
<script setup>
|
||||
import FormBase from '@/components/FormBase.vue'
|
||||
import router from '@/router'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FormBase btn-txt="Signup" api-endpoint="/user/signup">
|
||||
<form>
|
||||
<label for="username">Username:</label>
|
||||
<input type="text" id="username" placeholder="Username" />
|
||||
<input type="text" id="username" v-model="username" placeholder="Username" />
|
||||
<label for="email">Email:</label>
|
||||
<input type="email" id="email" placeholder="Email" />
|
||||
<input type="email" id="email" v-model="email" placeholder="Email" />
|
||||
<label for="password">Password:</label>
|
||||
<input type="password" id="password" placeholder="Password" />
|
||||
</FormBase>
|
||||
<input type="password" id="password" v-model="password" placeholder="Password" />
|
||||
<button @click.prevent="formAction">Sign up</button>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import User from '@/api/user'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
username: '',
|
||||
email: '',
|
||||
password: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async formAction() {
|
||||
const status = await User.registerUser({ username: this.username, email: this.email, password: this.password })
|
||||
if (status.code == 201) {
|
||||
throw router.push('/')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user