fix login validator
This commit is contained in:
@@ -48,14 +48,14 @@
|
||||
</q-layout>>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { useQuasar } from 'quasar'
|
||||
import { useQuasar, QForm } from 'quasar'
|
||||
// import { useRouter } from 'vue-router';
|
||||
import { ref } from 'vue';
|
||||
// import { Auth } from '../control/auth'
|
||||
import { useAuthStore } from 'stores/useAuthStore';
|
||||
const authStore = useAuthStore();
|
||||
const $q = useQuasar()
|
||||
const loginForm = ref(null);
|
||||
const loginForm = ref<QForm>();
|
||||
const loading = ref(false);
|
||||
let title = ref('ログイン');
|
||||
let email = ref('');
|
||||
@@ -78,7 +78,12 @@ import { useAuthStore } from 'stores/useAuthStore';
|
||||
passwordFieldType.value = visibility.value ? 'text' : 'password'
|
||||
visibilityIcon.value = visibility.value ? 'visibility_off' : 'visibility'
|
||||
}
|
||||
const submit = async () =>{
|
||||
const submit = () => {
|
||||
if (!loginForm.value) {
|
||||
return;
|
||||
}
|
||||
loginForm.value.validate().then(async (success) => {
|
||||
if (success) {
|
||||
loading.value=true;
|
||||
try {
|
||||
const result = await authStore.login(email.value,password.value);
|
||||
@@ -106,7 +111,8 @@ import { useAuthStore } from 'stores/useAuthStore';
|
||||
message: 'ログイン失敗'
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user