Pridani notifikace pri nezdarenem loginu
This commit is contained in:
@@ -28,7 +28,7 @@ const props = defineProps({
|
|||||||
type: String,
|
type: String,
|
||||||
required: false,
|
required: false,
|
||||||
default: "id"
|
default: "id"
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const model = ref({});
|
const model = ref({});
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ export const warningObject = (message) => ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
export const errorObject = (message) => ({
|
export const errorObject = (message, timeout = null) => ({
|
||||||
message,
|
message,
|
||||||
position: "top",
|
position: "top",
|
||||||
color: "negative",
|
color: "negative",
|
||||||
timeout: 5 * 60 * 1000,
|
timeout: timeout || 5 * 60 * 1000,
|
||||||
actions: [{ icon: 'close', color: 'white', round: true, handler: () => { }}]
|
actions: [{ icon: 'close', color: 'white', round: true, handler: () => { }}]
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3,15 +3,20 @@ import {ref} from "vue";
|
|||||||
import {useUserStore} from "stores/User";
|
import {useUserStore} from "stores/User";
|
||||||
import {useRouter} from "vue-router";
|
import {useRouter} from "vue-router";
|
||||||
import {isRequired, isValidEmail, minLength} from "src/composables/form/rules";
|
import {isRequired, isValidEmail, minLength} from "src/composables/form/rules";
|
||||||
|
import {useQuasar} from "quasar";
|
||||||
|
import {errorObject} from "src/composables/dialog";
|
||||||
|
|
||||||
const email = ref("");
|
const email = ref("");
|
||||||
const password = ref("");
|
const password = ref("");
|
||||||
|
const $router = useRouter();
|
||||||
|
const $q = useQuasar();
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const logUser = () => {
|
const logUser = () => {
|
||||||
useUserStore().login({email: email.value, password: password.value}).then(() => {
|
useUserStore().login({email: email.value, password: password.value}).then(() => {
|
||||||
router.push({name: "myFlights"});
|
$router.push({name: "myFlights"});
|
||||||
});
|
}).catch((err) => {
|
||||||
|
$q.notify(errorObject("Přihlášení se nezdařilo."))
|
||||||
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
const rules = {
|
const rules = {
|
||||||
|
|||||||
Reference in New Issue
Block a user