added required field translations

This commit is contained in:
Komek Hayytnazarov 2022-10-03 12:03:45 +05:00
parent 6de984bf19
commit f311f020d4
3 changed files with 21 additions and 16 deletions

View File

@ -120,11 +120,11 @@ const isForgotPwdLoading = ref(false);
const rules = {
email: {
required: helpers.withMessage(t("REQUIRED_VALIDATION"), required),
email,
email: helpers.withMessage(t("EMAIL_VALIDATION"), email),
},
password: {
required,
required: helpers.withMessage(t("REQUIRED_VALIDATION"), required),
minLength: helpers.withMessage(
t("MIN_LENGTH_VALIDATION", { min: 8 }), minLength(8)
)

View File

@ -134,7 +134,7 @@ const formData = reactive({
const rules = {
email: {
required: helpers.withMessage(t("REQUIRED_VALIDATION"), required),
email,
email: helpers.withMessage(t("EMAIL_VALIDATION"), email),
},
phone: {

View File

@ -12,8 +12,7 @@
</a>
<div class="my-auto">
<img alt="" class="-intro-x w-1/2 -mt-16"
src="@/assets/images/illustration.svg" />
<img alt="" class="-intro-x w-1/2 -mt-16" src="@/assets/images/illustration.svg" />
<div class="-intro-x text-white font-medium text-4xl leading-tight mt-10">
{{$t('SIGN_IN_MOTIVATION')}} <br />
{{$t('SING_IN_MOTIVATION_RIGHT')}}
@ -105,7 +104,7 @@
import { onMounted, reactive, toRefs, ref, watch } from "vue";
import dom from "@left4code/tw-starter/dist/js/dom";
import { useVuelidate } from "@vuelidate/core";
import { required, minLength, email } from "@vuelidate/validators";
import { required, minLength, email, helpers } from "@vuelidate/validators";
import { useAlertStore } from "@/stores";
import router from "@/router";
import Logo from "@/components/logo/Main.vue";
@ -124,21 +123,27 @@ const isLoading = ref(false);
const rules = {
email: {
required,
email,
required: helpers.withMessage(t("REQUIRED_VALIDATION"), required),
email: helpers.withMessage(t("EMAIL_VALIDATION"), email),
},
password: {
required,
minLength: minLength(8),
required: helpers.withMessage(t("REQUIRED_VALIDATION"), required),
minLength: helpers.withMessage(
t("MIN_LENGTH_VALIDATION", { min: 8 }), minLength(8)
)
},
confirm_password: {
required,
minLength: minLength(8),
required: helpers.withMessage(t("REQUIRED_VALIDATION"), required),
minLength: helpers.withMessage(
t("MIN_LENGTH_VALIDATION", { min: 8 }), minLength(8)
)
},
token: {
required,
minLength: minLength(4),
required: helpers.withMessage(t("REQUIRED_VALIDATION"), required),
minLength: helpers.withMessage(
t("MIN_LENGTH_VALIDATION", { min: 4 }), minLength(4)
)
},
};
@ -149,7 +154,7 @@ const onLogin = () => router.push({ path: "/" });
const onUpdate = async () => {
validate.value.$touch();
//console.log("formData: ", formData);
//console.log("formData: ", formData);
// check form validation
if (validate.value.$invalid) return;
@ -162,7 +167,7 @@ const onUpdate = async () => {
formData,
});
//console.log("update password", response);
//console.log("update password", response);
isLoading.value = false;