Minor tweaks to login

This commit is contained in:
2023-11-16 22:11:48 -05:00
parent 214cfbd1be
commit b4687d6b79
3 changed files with 25 additions and 6 deletions

View File

@@ -43,6 +43,22 @@
flat
></q-btn> -->
</q-form>
<q-dialog v-model="alert">
<q-card>
<q-card-section>
<div class="text-h6">Login Failed</div>
</q-card-section>
<q-card-section class="q-pt-none">
Login failed: {{ message }}
</q-card-section>
<q-card-actions align="right">
<q-btn flat label="OK" color="primary" v-close-popup />
</q-card-actions>
</q-card>
</q-dialog>
</q-card-section>
</q-card>
</q-page>
@@ -81,6 +97,8 @@ const email = ref('');
const password = ref('');
const router = useRouter();
const q = useQuasar();
const alert = ref(false);
const message = ref('');
function login(email: string, password: string) {
const notification = q.notify({
@@ -101,14 +119,16 @@ function login(email: string, password: string) {
spinner: false,
icon: 'check_circle',
});
router.push({ name: 'index' });
router.replace({ name: 'index' });
})
.catch((reason: Error) => {
.catch(function (reason: Error) {
notification({
type: 'negative',
message: 'Login failed. Error:' + reason.message,
timeout: 2000,
message: 'Login failed.',
timeout: 1,
});
message.value = reason.message;
alert.value = true;
});
}
</script>