added translations for fn message

This commit is contained in:
Komek Hayytnazarov 2022-10-01 12:08:03 +05:00
parent 6be8785cd1
commit 8141d05858
5 changed files with 17 additions and 9 deletions

View File

@ -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),

View File

@ -108,4 +108,6 @@ export const locale = {
UPDATE: "Update",
UPDATE_PWD: "Update password",
INT_CONN_ERROR: "Please connect to internet and try again!",
};

View File

@ -108,4 +108,6 @@ export const locale = {
UPDATE: "Update",
UPDATE_PWD: "Update password",
INT_CONN_ERROR: "Пожалуйста, подключитесь к Интернету и повторите попытку!",
};

View File

@ -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!",
};

View File

@ -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