- risolto problema della non attesa della PWA durante la chiamata a Node.js.
- risolto problema dell'ambiente in Locale HTTPS certificato installato aggiornato.
This commit is contained in:
@@ -4,20 +4,20 @@ import axios, {
|
||||
import { Api } from '@api'
|
||||
import type * as Types from '@src/store/Api/ApiTypes'
|
||||
|
||||
async function sendRequest(url: string, method: string, mydata: any, myformdata?: any, responsedata?: any, options?: any) {
|
||||
// console.log('sendRequest', method, url, mydata)
|
||||
|
||||
let request
|
||||
if (method === 'GET') request = Api.get(url, mydata, responsedata)
|
||||
else if (method === 'POST') request = Api.post(url, mydata, responsedata, options)
|
||||
else if (method === 'postFormData') request = Api.postFormData(url, myformdata, responsedata)
|
||||
else if (method === 'DELETE') request = Api.Delete(url, mydata, responsedata)
|
||||
else if (method === 'PUT') request = Api.put(url, mydata, responsedata)
|
||||
else if (method === 'PATCH') request = Api.patch(url, mydata, responsedata)
|
||||
|
||||
// @ts-ignore
|
||||
const req: Promise<Types.AxiosSuccess | Types.AxiosError> = request
|
||||
return req
|
||||
// Funzione che smista la richiesta in base al metodo
|
||||
async function sendRequest(url, method, mydata, myformdata, responsedata, options) {
|
||||
const actions = {
|
||||
get: () => Api.get(url, mydata, responsedata),
|
||||
post: () => Api.post(url, mydata, responsedata, options),
|
||||
postformdata: () => Api.postFormData(url, myformdata, responsedata),
|
||||
delete: () => Api.Delete(url, mydata, responsedata),
|
||||
put: () => Api.put(url, mydata, responsedata),
|
||||
patch: () => Api.patch(url, mydata, responsedata),
|
||||
};
|
||||
const key = method.toLowerCase();
|
||||
if (actions[key]) return await actions[key]();
|
||||
throw new Error(`Metodo non supportato: ${method}`);
|
||||
}
|
||||
|
||||
export default sendRequest
|
||||
|
||||
@@ -111,113 +111,65 @@ function getIterableStream(stream: NodeJS.ReadableStream): AsyncIterable<any> {
|
||||
};
|
||||
}
|
||||
|
||||
async function Request(type: string, path: string, payload: any, responsedata?: any, options?: any): Promise<Types.AxiosSuccess | Types.AxiosError | undefined> {
|
||||
|
||||
let ricevuto = false
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
const baseURL = globalStore.getServerHost()
|
||||
|
||||
// Funzione helper per inviare la richiesta HTTP
|
||||
async function Request(type, path, payload, responsedata = {}, options = {}) {
|
||||
const userStore = useUserStore();
|
||||
const globalStore = useGlobalStore();
|
||||
const baseURL = globalStore.getServerHost();
|
||||
|
||||
try {
|
||||
if (tools.isDebug()) console.log('Axios Request', path, type, tools.notshowPwd(payload))
|
||||
let response: AxiosResponse
|
||||
const config: AxiosRequestConfig = {
|
||||
if (tools.isDebug()) console.log('Axios Request', path, type, tools.notshowPwd(payload));
|
||||
|
||||
const isFormData = type === 'postFormData';
|
||||
const config = {
|
||||
baseURL,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Content-Type': isFormData ? 'multipart/form-data' : 'application/json',
|
||||
'x-auth': userStore.x_auth_token,
|
||||
'x-refrtok': userStore.refreshToken,
|
||||
},
|
||||
...responsedata,
|
||||
}
|
||||
};
|
||||
|
||||
if (options?.stream) {
|
||||
config.responseType = 'stream';
|
||||
}
|
||||
if (options?.stream) config.responseType = 'stream';
|
||||
|
||||
if (type === 'post' || type === 'put' || type === 'patch') {
|
||||
let response;
|
||||
const method = type.toLowerCase();
|
||||
|
||||
// Gestione dinamica del metodo HTTP
|
||||
if (['post', 'put', 'patch'].includes(method)) {
|
||||
if (options?.stream) {
|
||||
console.log('GENERATESTREAM...')
|
||||
// Gestione stream (riconosciuta come promise)
|
||||
const stream = await generateStream(path, payload, config, options);
|
||||
console.log('USCITOOOOOOOOOOOOOOOOOOOOO ------------------------')
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const events$: Observable<any> = from(stream);
|
||||
events$
|
||||
from(stream)
|
||||
.pipe(
|
||||
mergeMap((event) => from([event])),
|
||||
mergeMap(event => from([event])),
|
||||
toArray()
|
||||
)
|
||||
.subscribe(
|
||||
(data) => {
|
||||
console.log('Received data:', data);
|
||||
// Elabora i dati ricevuti
|
||||
resolve({ data, status: response.status, statusText: response.statusText, headers: response.headers, config: response.config });
|
||||
resolve({
|
||||
data,
|
||||
status: response.status,
|
||||
statusText: response.statusText,
|
||||
headers: response.headers,
|
||||
config: response.config,
|
||||
});
|
||||
},
|
||||
(error) => {
|
||||
console.error('Stream error:', error);
|
||||
reject(error);
|
||||
},
|
||||
() => {
|
||||
console.log('Stream completed');
|
||||
}
|
||||
() => console.log('Stream completed')
|
||||
);
|
||||
|
||||
});
|
||||
} else {
|
||||
|
||||
response = await axiosInstance[type](path, payload, config)
|
||||
|
||||
ricevuto = true
|
||||
// console.log('Request Response: ', response)
|
||||
// console.log(new Types.AxiosSuccess(response.data, response.status))
|
||||
|
||||
const setAuthToken = (path === '/updatepwd') || (path === '/users/login')
|
||||
|
||||
// console.log('--------- 0 ')
|
||||
|
||||
if (response && (response.status === 200)) {
|
||||
let x_auth_token = ''
|
||||
let refreshToken = ''
|
||||
try {
|
||||
if (setAuthToken || (path === '/users/login')) {
|
||||
x_auth_token = String(response.headers['x-auth'])
|
||||
refreshToken = String(response.headers['x-refrtok'])
|
||||
|
||||
if (x_auth_token === '') {
|
||||
userStore.setServerCode(toolsext.ERR_AUTHENTICATION)
|
||||
}
|
||||
if (setAuthToken) {
|
||||
userStore.UpdatePwd(x_auth_token, refreshToken)
|
||||
localStorage.setItem(toolsext.localStorage.token, x_auth_token)
|
||||
localStorage.setItem(toolsext.localStorage.refreshToken, refreshToken)
|
||||
}
|
||||
|
||||
userStore.setAuth(x_auth_token, refreshToken)
|
||||
localStorage.setItem(toolsext.localStorage.token, x_auth_token)
|
||||
localStorage.setItem(toolsext.localStorage.refreshToken, refreshToken)
|
||||
}
|
||||
|
||||
globalStore.setStateConnection(ricevuto ? 'online' : 'offline')
|
||||
userStore.setServerCode(tools.OK)
|
||||
} catch (e) {
|
||||
if (setAuthToken) {
|
||||
userStore.setServerCode(toolsext.ERR_AUTHENTICATION)
|
||||
userStore.setAuth('', '')
|
||||
}
|
||||
globalStore.setStateConnection(ricevuto ? 'online' : 'offline')
|
||||
return Promise.reject(new Types.AxiosError(serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN, null, toolsext.ERR_AUTHENTICATION))
|
||||
}
|
||||
}
|
||||
|
||||
return new Types.AxiosSuccess(response.data, response.status)
|
||||
response = await axiosInstance[method](path, payload, config);
|
||||
}
|
||||
} else if (type === 'get' || type === 'delete') {
|
||||
// @ts-ignore
|
||||
response = await axiosInstance[type](path, {
|
||||
} else if (['get', 'delete'].includes(method)) {
|
||||
response = await axiosInstance[method](path, {
|
||||
baseURL,
|
||||
params: payload,
|
||||
headers: {
|
||||
@@ -226,54 +178,58 @@ async function Request(type: string, path: string, payload: any, responsedata?:
|
||||
'x-refrtok': userStore.refreshToken,
|
||||
},
|
||||
...responsedata,
|
||||
})
|
||||
ricevuto = true
|
||||
return new Types.AxiosSuccess(response.data, response.status)
|
||||
});
|
||||
} else if (type === 'postFormData') {
|
||||
console.log('postFormData', payload)
|
||||
response = await axiosInstance.post(path, payload, {
|
||||
baseURL,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
'x-auth': userStore.x_auth_token,
|
||||
'x-refrtok': userStore.refreshToken,
|
||||
},
|
||||
...responsedata,
|
||||
})
|
||||
ricevuto = true
|
||||
return new Types.AxiosSuccess(response.data, response.status)
|
||||
response = await axiosInstance.post(path, payload, config);
|
||||
} else {
|
||||
throw new Error(`Unsupported request type: ${type}`);
|
||||
}
|
||||
} catch (error: any) {
|
||||
|
||||
// Gestione aggiornamento token se necessario
|
||||
const setAuthToken = (path === '/updatepwd' || path === '/users/login');
|
||||
if (response && response.status === 200 && (setAuthToken || path === '/users/login')) {
|
||||
const x_auth_token = String(response.headers['x-auth'] || '');
|
||||
const refreshToken = String(response.headers['x-refrtok'] || '');
|
||||
if (!x_auth_token) {
|
||||
userStore.setServerCode(toolsext.ERR_AUTHENTICATION);
|
||||
}
|
||||
if (setAuthToken) {
|
||||
userStore.UpdatePwd(x_auth_token, refreshToken);
|
||||
localStorage.setItem(toolsext.localStorage.token, x_auth_token);
|
||||
localStorage.setItem(toolsext.localStorage.refreshToken, refreshToken);
|
||||
}
|
||||
userStore.setAuth(x_auth_token, refreshToken);
|
||||
localStorage.setItem(toolsext.localStorage.token, x_auth_token);
|
||||
localStorage.setItem(toolsext.localStorage.refreshToken, refreshToken);
|
||||
}
|
||||
|
||||
globalStore.setStateConnection('online');
|
||||
userStore.setServerCode(tools.OK);
|
||||
return new Types.AxiosSuccess(response.data, response.status);
|
||||
} catch (error) {
|
||||
// Aggiornamento asincrono dello stato di connessione (setTimeout per dare tempo a eventuali animazioni)
|
||||
setTimeout(() => {
|
||||
globalStore.connData.uploading_server = (globalStore.connData.uploading_server === 1) ? -1 : globalStore.connData.uploading_server
|
||||
globalStore.connData.downloading_server = (globalStore.connData.downloading_server === 1) ? -1 : globalStore.connData.downloading_server
|
||||
}, 1000)
|
||||
if (['get'].includes(type.toLowerCase())) {
|
||||
globalStore.connData.downloading_server = (globalStore.connData.downloading_server === 1) ? -1 : globalStore.connData.downloading_server;
|
||||
} else {
|
||||
globalStore.connData.uploading_server = (globalStore.connData.uploading_server === 1) ? -1 : globalStore.connData.uploading_server;
|
||||
globalStore.connData.downloading_server = (globalStore.connData.downloading_server === 1) ? -1 : globalStore.connData.downloading_server;
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
if (import.meta.env.DEV) {
|
||||
console.log('ERROR using', path)
|
||||
// console.log('Error received: ', error)
|
||||
// console.log('ricevuto=', ricevuto)
|
||||
console.log('error.response=', error.response)
|
||||
console.log('ERROR using', path);
|
||||
console.log('error.response=', error.response);
|
||||
}
|
||||
let mycode = 0
|
||||
if (!ricevuto) {
|
||||
mycode = toolsext.ERR_SERVERFETCH
|
||||
userStore.setServerCode(toolsext.ERR_SERVERFETCH)
|
||||
} else {
|
||||
mycode = toolsext.ERR_GENERICO
|
||||
userStore.setServerCode(toolsext.ERR_GENERICO)
|
||||
}
|
||||
|
||||
let mycode = 0;
|
||||
if (error.response) {
|
||||
let code = 0
|
||||
if (error.response.data && error.response.data.code) {
|
||||
code = error.response.data.code
|
||||
mycode = error.response.data.code
|
||||
userStore.setServerCode(mycode)
|
||||
}
|
||||
return Promise.reject(new Types.AxiosError(error.response.status, error.response.data, code))
|
||||
const code = error.response.data?.code || 0;
|
||||
mycode = code;
|
||||
userStore.setServerCode(mycode);
|
||||
return Promise.reject(new Types.AxiosError(error.response.status, error.response.data, code));
|
||||
}
|
||||
return Promise.reject(new Types.AxiosError(0, null, mycode, error))
|
||||
return Promise.reject(new Types.AxiosError(0, null, mycode, error));
|
||||
}
|
||||
}
|
||||
|
||||
export default Request
|
||||
|
||||
@@ -41,43 +41,43 @@ export const Api = {
|
||||
const globalStore = useGlobalStore()
|
||||
globalStore.connData.downloading_server = 1
|
||||
globalStore.connData.uploading_server = 1
|
||||
return Request('post', path, payload, responsedata, options)
|
||||
return await Request('post', path, payload, responsedata, options)
|
||||
},
|
||||
|
||||
async postFormData(path: string, payload?: any, responsedata?: any) {
|
||||
const globalStore = useGlobalStore()
|
||||
globalStore.connData.uploading_server = 1
|
||||
globalStore.connData.downloading_server = 1
|
||||
return Request('postFormData', path, payload, responsedata)
|
||||
return await Request('postFormData', path, payload, responsedata)
|
||||
},
|
||||
|
||||
async get(path: string, payload?: any, responsedata?: any) {
|
||||
const globalStore = useGlobalStore()
|
||||
globalStore.connData.downloading_server = 1
|
||||
globalStore.connData.uploading_server = 0
|
||||
return Request('get', path, payload, responsedata)
|
||||
return await Request('get', path, payload, responsedata)
|
||||
},
|
||||
|
||||
async put(path: string, payload?: any, responsedata?: any) {
|
||||
const globalStore = useGlobalStore()
|
||||
globalStore.connData.uploading_server = 1
|
||||
return Request('put', path, payload, responsedata)
|
||||
return await Request('put', path, payload, responsedata)
|
||||
},
|
||||
|
||||
async patch(path: string, payload?: any, responsedata?: any) {
|
||||
const globalStore = useGlobalStore()
|
||||
globalStore.connData.uploading_server = 1
|
||||
return Request('patch', path, payload, responsedata)
|
||||
return await Request('patch', path, payload, responsedata)
|
||||
},
|
||||
|
||||
async Delete(path: string, payload: any, responsedata?: any) {
|
||||
const globalStore = useGlobalStore()
|
||||
globalStore.connData.uploading_server = 1
|
||||
return Request('delete', path, payload, responsedata)
|
||||
return await Request('delete', path, payload, responsedata)
|
||||
},
|
||||
|
||||
async checkSession({ token, refresh_token }: any) {
|
||||
return axios.post(import.meta.env.VITE_API_URL + Paths.TOKEN_REFRESH, {
|
||||
return await axios.post(import.meta.env.VITE_API_URL + Paths.TOKEN_REFRESH, {
|
||||
refresh_token,
|
||||
}, {
|
||||
headers: {
|
||||
@@ -158,70 +158,61 @@ export const Api = {
|
||||
return null;
|
||||
},
|
||||
|
||||
async SendReqBase(url: string, method: string, mydata: any, setAuthToken = false, evitaloop = false, myformdata?: any, responsedata?: any, options?: any): Promise<Types.AxiosSuccess | Types.AxiosError> {
|
||||
// Base per la chiamata con gestione degli errori e retry
|
||||
async SendReqBase(url, method, mydata, setAuthToken = false, evitaloop = false, myformdata, responsedata, options) {
|
||||
const mydataout = {
|
||||
...mydata,
|
||||
keyappid: import.meta.env.VITE_PAO_APP_ID,
|
||||
idapp: tools.getEnv('VITE_APP_ID'),
|
||||
}
|
||||
};
|
||||
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
const userStore = useUserStore();
|
||||
const globalStore = useGlobalStore();
|
||||
userStore.setServerCode(tools.EMPTY);
|
||||
userStore.setResStatus(0);
|
||||
|
||||
try {
|
||||
const res = await sendRequest(url, method, mydataout, myformdata, responsedata, options);
|
||||
|
||||
userStore.setServerCode(tools.EMPTY)
|
||||
userStore.setResStatus(0)
|
||||
|
||||
return new Promise((resolve, reject) => sendRequest(url, method, mydataout, myformdata, responsedata, options)
|
||||
.then(async (res) => {
|
||||
setTimeout(() => {
|
||||
if (method === 'get') {
|
||||
globalStore.connData.downloading_server = 0
|
||||
} else {
|
||||
globalStore.connData.uploading_server = 0
|
||||
globalStore.connData.downloading_server = 0
|
||||
}
|
||||
}, 1000)
|
||||
|
||||
if (res.status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN) {
|
||||
userStore.setServerCode(toolsext.ERR_AUTHENTICATION);
|
||||
userStore.setAuth('', '');
|
||||
return reject({ code: toolsext.ERR_AUTHENTICATION });
|
||||
}
|
||||
|
||||
const ret = await this.checkTokenScaduto(res.status, evitaloop, resolve, reject, url, method, mydata, setAuthToken);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (tools.isDebug())
|
||||
console.log(' ----> ', res)
|
||||
|
||||
return resolve(res)
|
||||
})
|
||||
.catch(async (error) => {
|
||||
setTimeout(() => {
|
||||
if (method === 'get') {
|
||||
globalStore.connData.downloading_server = -1
|
||||
} else {
|
||||
globalStore.connData.uploading_server = -1
|
||||
globalStore.connData.downloading_server = -1
|
||||
}
|
||||
}, 1000)
|
||||
|
||||
let ret = await this.checkTokenScaduto(error.status, evitaloop, resolve, reject, url, method, mydataout, setAuthToken)
|
||||
if (ret) {
|
||||
return ret
|
||||
// Aggiornamento dello stato della connessione dopo 1 secondo
|
||||
setTimeout(() => {
|
||||
if (method.toLowerCase() === 'get') {
|
||||
globalStore.connData.downloading_server = 0;
|
||||
} else {
|
||||
ret = await this.checkTokenScaduto(error.status, evitaloop, resolve, reject, url, method, mydataout, setAuthToken)
|
||||
globalStore.connData.uploading_server = 0;
|
||||
globalStore.connData.downloading_server = 0;
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
console.error('Errore nella richiesta:', error);
|
||||
return reject(error);
|
||||
}))
|
||||
if (res.status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN) {
|
||||
userStore.setServerCode(toolsext.ERR_AUTHENTICATION);
|
||||
userStore.setAuth('', '');
|
||||
throw { code: toolsext.ERR_AUTHENTICATION };
|
||||
}
|
||||
|
||||
// Verifica sul token (funzione custom, che deve restituire un valore se serve un nuovo flusso)
|
||||
const ret = await this.checkTokenScaduto(res.status, evitaloop, res, null, url, method, mydata, setAuthToken);
|
||||
if (ret) return ret;
|
||||
|
||||
if (tools.isDebug()) console.log(' ----> ', res);
|
||||
return res;
|
||||
} catch (error) {
|
||||
setTimeout(() => {
|
||||
if (method.toLowerCase() === 'get') {
|
||||
globalStore.connData.downloading_server = -1;
|
||||
} else {
|
||||
globalStore.connData.uploading_server = -1;
|
||||
globalStore.connData.downloading_server = -1;
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
const ret = await this.checkTokenScaduto(error.status, evitaloop, null, error, url, method, mydataout, setAuthToken);
|
||||
if (ret) return ret;
|
||||
console.error('Errore nella richiesta:', error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Creates a Promise that resolves after a specified number of milliseconds.
|
||||
* Useful for creating delayed operations or pause in async functions.
|
||||
@@ -254,43 +245,17 @@ export const Api = {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
},
|
||||
|
||||
async SendReq(
|
||||
url: string,
|
||||
method: string,
|
||||
mydata: any,
|
||||
setAuthToken = false,
|
||||
evitaloop = false,
|
||||
retryCount = 3,
|
||||
retryDelay = 5000,
|
||||
myformdata?: any,
|
||||
responsedata?: any,
|
||||
options?: any,
|
||||
): Promise<Types.AxiosSuccess | Types.AxiosError> {
|
||||
// Funzione che gestisce la chiamata con retry
|
||||
async SendReq(url, method, mydata, setAuthToken = false, evitaloop = false, retryCount = 3, retryDelay = 5000, myformdata = null, responsedata = null, options = null) {
|
||||
try {
|
||||
const response = await this.SendReqBase(url, method, mydata, setAuthToken, evitaloop, myformdata, responsedata, options);
|
||||
return response;
|
||||
} catch (error: any) {
|
||||
let riprova = true
|
||||
try {
|
||||
riprova = (error.status !== 403);
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
return await this.SendReqBase(url, method, mydata, setAuthToken, evitaloop, myformdata, responsedata, options);
|
||||
} catch (error) {
|
||||
// Se lo status non è 403 e sono rimasti tentativi, eseguo il retry
|
||||
const riprova = error.status !== 403;
|
||||
if (retryCount > 0 && riprova) {
|
||||
// (!error.hasOwnProperty('data') || (error.hasOwnProperty('data') && !error.data.error.hasOwnProperty('code')) && (!error.hasOwnProperty('msgerr')))
|
||||
console.log(`❌❌❌ Retrying request. Attempts remaining: ${retryCount}`);
|
||||
await this.delay(retryDelay);
|
||||
return this.SendReq(
|
||||
url,
|
||||
method,
|
||||
mydata,
|
||||
setAuthToken,
|
||||
evitaloop,
|
||||
retryCount - 1,
|
||||
retryDelay,
|
||||
myformdata,
|
||||
responsedata,
|
||||
);
|
||||
return this.SendReq(url, method, mydata, setAuthToken, evitaloop, retryCount - 1, retryDelay, myformdata, responsedata);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
@@ -8289,18 +8289,18 @@ export const tools = {
|
||||
return ''
|
||||
},
|
||||
|
||||
getNameToShow(user: IUserFields, col: any = null): string {
|
||||
getNameToShow(user: IUserFields, col: any = null, options = null): string {
|
||||
const userStore = useUserStore()
|
||||
|
||||
const name = userStore.getNameToShow(user, col)
|
||||
const name = userStore.getNameToShow(user, col, options)
|
||||
|
||||
return name
|
||||
},
|
||||
|
||||
getUserNameOnlyIfToShow(user: IUserFields, col: any = null): string {
|
||||
getUserNameOnlyIfToShow(user: IUserFields, col: any = null, options = null): string {
|
||||
const userStore = useUserStore()
|
||||
|
||||
const name = userStore.getUserNameOnlyIfToShow(user, col)
|
||||
const name = userStore.getUserNameOnlyIfToShow(user, col, options)
|
||||
|
||||
return name
|
||||
},
|
||||
|
||||
@@ -1739,8 +1739,14 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
|
||||
// calendarStore.editable = false
|
||||
|
||||
return Api.SendReq(`/loadsite/${myuserid}/${tools.getEnv('VITE_APP_ID')}/${import.meta.env.VITE_APP_VERSION}`, 'GET', null)
|
||||
.then((res) => {
|
||||
try {
|
||||
console.log('CHIAMA testpao...')
|
||||
const restest = await Api.SendReq(`/testpao/`, 'GET', null)
|
||||
console.log(' RISULTATO = ', restest)
|
||||
|
||||
const res = await Api.SendReq(`/loadsite/${myuserid}/${tools.getEnv('VITE_APP_ID')}/${import.meta.env.VITE_APP_VERSION}`, 'GET', null)
|
||||
if (res.status === 200) {
|
||||
|
||||
console.log('____________________________ res', res)
|
||||
this.serverError = false
|
||||
if (res.status === 200) {
|
||||
@@ -1874,16 +1880,18 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
}
|
||||
|
||||
return true
|
||||
}).then((res) => res).catch((error) => {
|
||||
if (error.status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_TOKEN_EXPIRED) {
|
||||
} else {
|
||||
}
|
||||
} catch (error) {
|
||||
if (error.status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_TOKEN_EXPIRED) {
|
||||
|
||||
}
|
||||
console.log('error dbLoad', error)
|
||||
// userStore.setErrorCatch(error)
|
||||
this.serverError = true
|
||||
this.serverMsgError = error
|
||||
return new Types.AxiosError(serv_constants.RIS_CODE_ERR, null, toolsext.ERR_GENERICO, error)
|
||||
})
|
||||
}
|
||||
console.log('error dbLoad', error)
|
||||
// userStore.setErrorCatch(error)
|
||||
this.serverError = true
|
||||
this.serverMsgError = error
|
||||
return new Types.AxiosError(serv_constants.RIS_CODE_ERR, null, toolsext.ERR_GENERICO, error)
|
||||
}
|
||||
},
|
||||
|
||||
getProvinceByProv(provstr: string) {
|
||||
|
||||
Reference in New Issue
Block a user