-
Notifications
You must be signed in to change notification settings - Fork 176
/
Signup.vue
86 lines (85 loc) · 2.33 KB
/
Signup.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<template>
<v-container>
<v-layout row>
<v-flex xs12 sm6 offset-sm3>
<v-card>
<v-card-text>
<v-container>
<form @submit.prevent="onSignup">
<v-layout row>
<v-flex xs12>
<v-text-field
name="email"
label="Mail"
id="email"
v-model="email"
type="email"
required></v-text-field>
</v-flex>
</v-layout>
<v-layout row>
<v-flex xs12>
<v-text-field
name="password"
label="Password"
id="password"
v-model="password"
type="password"
required></v-text-field>
</v-flex>
</v-layout>
<v-layout row>
<v-flex xs12>
<v-text-field
name="confirmPassword"
label="Confirm Password"
id="confirmPassword"
v-model="confirmPassword"
type="password"
:rules="[comparePasswords]"></v-text-field>
</v-flex>
</v-layout>
<v-layout row>
<v-flex xs12>
<v-btn type="submit">Sign up</v-btn>
</v-flex>
</v-layout>
</form>
</v-container>
</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-container>
</template>
<script>
export default {
data () {
return {
email: '',
password: '',
confirmPassword: ''
}
},
computed: {
comparePasswords () {
return this.password !== this.confirmPassword ? 'Passwords do not match' : ''
},
user () {
return this.$store.getters.user
}
},
watch: {
user (value) {
if (value !== null && value !== undefined) {
this.$router.push('/')
}
}
},
methods: {
onSignup () {
this.$store.dispatch('signUserUp', {email: this.email, password: this.password})
}
}
}
</script>