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

make to better

parent cb96a4e7
......@@ -3,6 +3,7 @@
v-model="show"
:color="color"
:timeout="6000"
top
>
{{ text }}
<v-btn
......
......@@ -27,7 +27,7 @@
color="deep-orange darken-4"
type="email"
v-model="loginData.email_users"
:rules="clickLogin ? [rules.required, rules.email] : []"
:rules="[rules.required, rules.email]"
required
></v-text-field>
<v-text-field
......@@ -37,7 +37,7 @@
:append-icon="showPassword ? 'visibility' : 'visibility_off'"
:type="showPassword ? 'text' : 'password'"
@click:append="showPassword = !showPassword"
:rules="clickLogin ? [rules.required] : []"
:rules="[rules.required]"
required
></v-text-field>
<p class="text-xs-right"><router-link to="/" class="body-2 font-weight-medium">ลืมรหัสผ่าน?</router-link></p>
......@@ -70,7 +70,6 @@ export default {
role: 1
},
showPassword: false,
clickLogin: false,
rules: {
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) || 'รูปแบบอีเมลล์ไม่ถูกต้อง'
......@@ -79,16 +78,10 @@ export default {
},
methods: {
login () {
this.clickLogin = true
if(this.$refs.login.validate() && this.loginData.email_users !== '' && this.loginData.password !== '') {
if(this.$refs.login.validate()) {
this.$store.dispatch('login', this.loginData)
.then(res => {
this.clickLogin = false
this.loginData = {
email_users: '',
password: '',
role: 1
}
this.$refs.login.reset()
})
}
}
......
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