diff --git a/src/api/fetch-wrapper.js b/src/api/fetch-wrapper.js index 91bd73d..30886ac 100644 --- a/src/api/fetch-wrapper.js +++ b/src/api/fetch-wrapper.js @@ -1,4 +1,5 @@ import { useAuthStore, useAlertStore } from "@/stores"; +import i18nn from "@/i18n"; export const fetchWrapper = { get: request("GET"), @@ -8,16 +9,15 @@ export const fetchWrapper = { }; function request(method) { - console.log("INT STATUS: ", navigator.onLine); - - if (!navigator.onLine) { - const alertStore = useAlertStore(); - alertStore.error("Please check your internet connection"); - return Promise.reject("connection error"); - } - return (url, body, isFormData = false) => { - console.log("url: " + url, "body: ", body, "isFormData: ", isFormData); + // check internet connection + if (!navigator.onLine) { + console.log("in if: ", i18nn); + const alertStore = useAlertStore(); + alertStore.error(i18nn.global.t("INT_CONN_ERROR")); + return Promise.reject("internet connection error"); + } + const requestOptions = { method, headers: authHeader(url), diff --git a/src/i18n/en.js b/src/i18n/en.js index be740f4..30bb117 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -108,4 +108,6 @@ export const locale = { UPDATE: "Update", UPDATE_PWD: "Update password", + + INT_CONN_ERROR: "Please connect to internet and try again!", }; diff --git a/src/i18n/ru.js b/src/i18n/ru.js index 8afc004..83a0efb 100644 --- a/src/i18n/ru.js +++ b/src/i18n/ru.js @@ -108,4 +108,6 @@ export const locale = { UPDATE: "Update", UPDATE_PWD: "Update password", + + INT_CONN_ERROR: "Пожалуйста, подключитесь к Интернету и повторите попытку!", }; diff --git a/src/i18n/tm.js b/src/i18n/tm.js index c8923a1..2fe642b 100644 --- a/src/i18n/tm.js +++ b/src/i18n/tm.js @@ -108,4 +108,6 @@ export const locale = { UPDATE: "Update", UPDATE_PWD: "Update password", + + INT_CONN_ERROR: "Internete birigip, gaýtadan synanyşmagyňyzy haýyş edýäris!", }; diff --git a/src/views/profile-forms/Business.vue b/src/views/profile-forms/Business.vue index 06150c0..26bea30 100644 --- a/src/views/profile-forms/Business.vue +++ b/src/views/profile-forms/Business.vue @@ -272,6 +272,8 @@ const onRegister = async () => { try { isLoading.value = true; + console.log('form data validation success'); + const response = await fetchWrapper.put( `${baseUrl}/account/profile`, formData