fixed bugs

This commit is contained in:
Komek Hayytnazarov 2022-12-01 16:26:46 +05:00
parent 06badccee7
commit 4738797c47
7 changed files with 33 additions and 19 deletions

View File

@ -184,4 +184,6 @@ export const locale = {
ACCOUNT_TYPE_REQUIRED: "Выберите тип аккаунта",
ALREADY_HAS_ACCOUNT: "Уже есть аккаунт? {0}",
YOU_HAVE_NO_ACCOUNT: "Нет аккаунта? {0}",
OP_SUCCESS: "Saved successfully.",
};

View File

@ -182,4 +182,6 @@ export const locale = {
ACCOUNT_TYPE_REQUIRED: "Выберите тип аккаунта",
ALREADY_HAS_ACCOUNT: "Уже есть аккаунт? {0}",
YOU_HAVE_NO_ACCOUNT: "Нет аккаунта? {0}",
OP_SUCCESS: "Успешно сохранено."
};

View File

@ -182,4 +182,6 @@ export const locale = {
ACCOUNT_TYPE_REQUIRED: "Выберите тип аккаунта",
ALREADY_HAS_ACCOUNT: "Уже есть аккаунт? {0}",
YOU_HAVE_NO_ACCOUNT: "Нет аккаунта? {0}",
OP_SUCCESS: "Ýatda saklandy.",
};

View File

@ -162,6 +162,8 @@ import { useVuelidate } from "@vuelidate/core";
import { fetchWrapper } from "@/api";
import { useRoute } from "vue-router";
import i18nn from "@/i18n";
import { useAlertStore } from "@/stores";
import { helper as $h } from "@/utils/helper";
import router from "@/router";
import _ from "lodash";
@ -169,6 +171,8 @@ const baseUrl = `${import.meta.env.VITE_API_URL}/api`;
const route = useRoute();
const alertStore = useAlertStore();
const maxDate = new Date();
const isLoading = ref(false);
@ -213,11 +217,10 @@ const rules = {
const validate = useVuelidate(rules, toRefs(formData));
watch(date, (currentValue, oldValue) => {
formData.account_date = currentValue;
formData.account_date = $h.changeDateFormat(currentValue);
});
const onRegister = async () => {
//console.log("formData.account_date: ", formData.account_date);
validate.value.$touch();
@ -231,28 +234,25 @@ const onRegister = async () => {
formData
);
isLoading.value = false;
//console.log("response onRegister: ", response);
console.log("response onRegister: ", response);
// refresh LS "bankAccount"
localStorage.removeItem("bankAccount");
localStorage.setItem("bankAccount", JSON.stringify(formData));
router.push({ name: "profile", params: { loadFromLS: true } });
alertStore.success(i18nn.global.t("OP_SUCCESS"));
} catch (error) {
isLoading.value = false;
// alertStore.success(i18nn.global.t("USER_CREATED_SUCCESS"),);
}
};
onMounted(() => {
const params = _.isEmpty(route.params)
? JSON.parse(localStorage.getItem("bankAccount"))
: route.params;
//console.log("Params: ", params);
const params = JSON.parse(localStorage.getItem("bankAccount"))
if (params) {
localStorage.setItem("bankAccount", JSON.stringify(params));
Object.assign(formData, params);
date.value = formData.account_date;
}
});
</script>

View File

@ -3,7 +3,7 @@
<h2 class="text-lg font-medium mr-auto">{{ $t('ACCOUNT_TYPE_BUSINESS') }}</h2>
</div>
<!-- BEGIN: Form Validation -->
<PreviewComponent class="intro-y box mt-5" >
<PreviewComponent class="intro-y box mt-5">
<div class="flex flex-col sm:flex-row items-center p-5 border-b border-slate-200/60 dark:border-darkmode-400">
<h2 class="font-medium text-base mr-auto">{{ $t('ENT_FORM') }}</h2>
</div>
@ -183,6 +183,7 @@ import { useVuelidate } from "@vuelidate/core";
import { fetchWrapper } from "@/api";
import { useRoute } from "vue-router";
import router from "@/router";
import { useAlertStore } from "@/stores";
import i18nn from "@/i18n";
import _ from "lodash";
import { helper as $h } from "@/utils/helper";
@ -192,6 +193,8 @@ const baseUrl = `${import.meta.env.VITE_API_URL}/api`;
const route = useRoute();
const alertStore = useAlertStore();
const maxDate = new Date();
const isLoading = ref(false);
@ -288,7 +291,8 @@ const onRegister = async () => {
localStorage.removeItem("profile");
localStorage.setItem("profile", JSON.stringify(formData));
router.push({ name: "profile", params: { loadFromLS: true } });
// router.push({ name: "profile", params: { loadFromLS: true } });
alertStore.success(i18nn.global.t("OP_SUCCESS"));
} catch (error) {
isLoading.value = false;
}

View File

@ -189,6 +189,7 @@ import { required, helpers } from "@vuelidate/validators";
import { useVuelidate } from "@vuelidate/core";
import { fetchWrapper } from "@/api";
import router from "@/router";
import { useAlertStore } from "@/stores";
import i18nn from "@/i18n";
import _ from "lodash";
import { helper as $h } from "@/utils/helper";
@ -199,6 +200,8 @@ const maxDate = new Date();
const isLoading = ref(false);
const alertStore = useAlertStore();
const date = ref("");
const formData = reactive({
@ -264,7 +267,8 @@ const onRegister = async () => {
isLoading.value = false;
//console.log("response onRegister: ", response);
router.push({ name: "profile", params: { loadFromLS: true } });
// router.push({ name: "profile", params: { loadFromLS: true } });
alertStore.success(i18nn.global.t("OP_SUCCESS"));
} catch (error) {
isLoading.value = false;
}

View File

@ -114,6 +114,7 @@ import { useVuelidate } from "@vuelidate/core";
import { fetchWrapper } from "@/api";
import { useRoute } from "vue-router";
import router from "@/router";
import { useAlertStore } from "@/stores";
import i18nn from "@/i18n";
import _ from "lodash";
@ -123,6 +124,8 @@ const route = useRoute();
const isLoading = ref(false);
const alertStore = useAlertStore();
const formData = reactive({
address: "",
email: "",
@ -170,19 +173,16 @@ const onRegister = async () => {
isLoading.value = false;
router.push({ name: "profile", params: { loadFromLS: true } });
// router.push({ name: "profile", params: { loadFromLS: true } });
alertStore.success(i18nn.global.t("OP_SUCCESS"));
} catch (error) {
isLoading.value = false;
}
};
onMounted(() => {
const params = _.isEmpty(route.params)
? JSON.parse(localStorage.getItem("contacts"))
: route.params;
const params = JSON.parse(localStorage.getItem("contacts"))
if (params) {
localStorage.setItem("contacts", JSON.stringify(params));
Object.assign(formData, params);
}
});