- fix: refresh token, codice di errore ...

This commit is contained in:
Surya Paolo
2025-03-15 14:52:25 +01:00
parent dfce2bc5eb
commit 201b739c8c
59 changed files with 726 additions and 87 deletions

View File

@@ -1023,9 +1023,11 @@ export const useGlobalStore = defineStore('GlobalStore', {
let stop = false
if (!await this.loadSite()) {
const { ris, status } = await this.loadSite()
if (status === toolsext.ERR_RETRY_LOGIN) {
stop = true
code = toolsext.ERR_RETRY_LOGIN
code = status
} else {
isok = true
}
@@ -1740,6 +1742,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
const Products = useProducts()
const catalogStore = useCatalogStore()
let status = 0
// console.log('calendarStore: loadAfterLogin')
// Load local data
const showall = userStore.isAdmin || userStore.isManager ? '1' : '0'
@@ -1750,6 +1754,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
try {
const res = await Api.SendReq(`/loadsite/${myuserid}/${tools.getEnv('VITE_APP_ID')}/${import.meta.env.VITE_APP_VERSION}`, 'GET', null)
status = res.status
if (res.status === 200) {
console.log('____________________________ res', res)
@@ -1884,15 +1889,18 @@ export const useGlobalStore = defineStore('GlobalStore', {
}
}
return true
return { ris: true, status }
} else {
}
} catch (error) {
status = error.status
if (error.status === toolsext.ERR_RETRY_LOGIN) {
} else {
if (error.status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_TOKEN_EXPIRED) {
if (error.status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_TOKEN_EXPIRED ||
error.status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN
) {
} else {
this.serverError = true
@@ -1904,10 +1912,10 @@ export const useGlobalStore = defineStore('GlobalStore', {
this.serverMsgError = error
//return new Types.AxiosError(serv_constants.RIS_CODE_ERR, null, toolsext.ERR_GENERICO, error)
return false
return { ris: false, status }
}
return false
return { ris: false, status }
},
getProvinceByProv(provstr: string) {