Commit 49bb997f authored by Kittisak Maneewong's avatar Kittisak Maneewong

make to better

parent cb96a4e7
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
v-model="show" v-model="show"
:color="color" :color="color"
:timeout="6000" :timeout="6000"
top
> >
{{ text }} {{ text }}
<v-btn <v-btn
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
color="deep-orange darken-4" color="deep-orange darken-4"
type="email" type="email"
v-model="loginData.email_users" v-model="loginData.email_users"
:rules="clickLogin ? [rules.required, rules.email] : []" :rules="[rules.required, rules.email]"
required required
></v-text-field> ></v-text-field>
<v-text-field <v-text-field
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
:append-icon="showPassword ? 'visibility' : 'visibility_off'" :append-icon="showPassword ? 'visibility' : 'visibility_off'"
:type="showPassword ? 'text' : 'password'" :type="showPassword ? 'text' : 'password'"
@click:append="showPassword = !showPassword" @click:append="showPassword = !showPassword"
:rules="clickLogin ? [rules.required] : []" :rules="[rules.required]"
required required
></v-text-field> ></v-text-field>
<p class="text-xs-right"><router-link to="/" class="body-2 font-weight-medium">ลืมรหัสผ่าน?</router-link></p> <p class="text-xs-right"><router-link to="/" class="body-2 font-weight-medium">ลืมรหัสผ่าน?</router-link></p>
...@@ -70,7 +70,6 @@ export default { ...@@ -70,7 +70,6 @@ export default {
role: 1 role: 1
}, },
showPassword: false, showPassword: false,
clickLogin: false,
rules: { rules: {
required: v => !!v || 'จำเป็นต้องกรอก', required: v => !!v || 'จำเป็นต้องกรอก',
email: v => /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(v) || 'รูปแบบอีเมลล์ไม่ถูกต้อง' email: v => /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(v) || 'รูปแบบอีเมลล์ไม่ถูกต้อง'
...@@ -79,16 +78,10 @@ export default { ...@@ -79,16 +78,10 @@ export default {
}, },
methods: { methods: {
login () { login () {
this.clickLogin = true if(this.$refs.login.validate()) {
if(this.$refs.login.validate() && this.loginData.email_users !== '' && this.loginData.password !== '') {
this.$store.dispatch('login', this.loginData) this.$store.dispatch('login', this.loginData)
.then(res => { .then(res => {
this.clickLogin = false this.$refs.login.reset()
this.loginData = {
email_users: '',
password: '',
role: 1
}
}) })
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment