- 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

@@ -2,7 +2,7 @@
<div>
<q-card class="my-card text-center">
<q-img :src="`images/` + myop.img" class="myimg">
<q-img :src="`/images/` + myop.img" class="myimg">
<div class="absolute-bottom text-spacetrans text-shadow">
<div class="text-h6 text-trans">{{ myop.name }} {{ myop.surname }}</div>
<div class="text-subtitle-carica text-trans">{{ myop.qualification }}</div>

View File

@@ -104,7 +104,7 @@
<q-avatar v-if="getWhereIcon(myevent.wherecode)">
<img
:src="
`images/avatar/` + getWhereIcon(myevent.wherecode)
`/images/avatar/` + getWhereIcon(myevent.wherecode)
"
alt="Località"
/>
@@ -1275,7 +1275,7 @@
<q-avatar v-if="getWhereIcon(event.wherecode)">
<img
:src="
`images/avatar/` + getWhereIcon(event.wherecode)
`/images/avatar/` + getWhereIcon(event.wherecode)
"
:alt="event.wherecode"
/>

View File

@@ -73,22 +73,22 @@ export default defineComponent({
}
const myIcon = L.icon({
iconUrl: 'images/icon.png',
iconUrl: '/images/icon.png',
iconSize: [30, 30],
iconAnchor: [22, 35],
popupAnchor: [-6, -36],
shadowUrl: 'images/marker-shadow.png',
shadowUrl: '/images/marker-shadow.png',
shadowSize: [60, 30],
shadowAnchor: [22, 35]
});
const myIconPosAtt = L.icon({
iconUrl: 'images/icon.png',
iconUrl: '/images/icon.png',
iconSize: [30, 30],
iconAnchor: [22, 35],
popupAnchor: [-6, -36],
shadowUrl: 'images/marker-shadow.png',
shadowUrl: '/images/marker-shadow.png',
shadowSize: [60, 30],
shadowAnchor: [22, 35]
});
@@ -331,7 +331,7 @@ export default defineComponent({
iconSize: [40, 40],
iconAnchor: [22, 35],
popupAnchor: [-6, -36],
shadowUrl: 'images/marker-shadow.png',
shadowUrl: '/images/marker-shadow.png',
shadowSize: [60, 30],
shadowAnchor: [22, 35]
});

View File

@@ -36,11 +36,11 @@ export default defineComponent({
const initialMap = ref(<any>null);
const myIcon = L.icon({
iconUrl: 'images/icon.png',
iconUrl: '/images/icon.png',
iconSize: [30, 30],
iconAnchor: [22, 35],
popupAnchor: [-6, -36],
shadowUrl: 'images/marker-shadow.png',
shadowUrl: '/images/marker-shadow.png',
shadowSize: [60, 30],
shadowAnchor: [22, 35]
});

View File

@@ -27,11 +27,11 @@ export default defineComponent({
const initialMap = ref(<any>null);
const myIcon = L.icon({
iconUrl: 'images/icon.png',
iconUrl: '/images/icon.png',
iconSize: [30, 30],
iconAnchor: [22, 35],
popupAnchor: [-6, -36],
shadowUrl: 'images/marker-shadow.png',
shadowUrl: '/images/marker-shadow.png',
shadowSize: [60, 30],
shadowAnchor: [22, 35]
});

View File

@@ -446,7 +446,7 @@
v-for="(myrec, ind) in myel.list"
:key="ind"
:name="ind"
:img-src="getsrcbyimg(`images/` + myrec.imagefile)"
:img-src="getsrcbyimg(`/images/` + myrec.imagefile)"
>
<div class="landing__header"></div>
<div

View File

@@ -235,7 +235,7 @@
>
</q-input>
<q-field v-if="col.showLinkResult && myvalue">
Diventerà: {{ tools.generateURL(col.showLinkResult, myvalue) }}
Diventerà: {{ tools.generateURL(col.showLinkResult, myvalue) }}
</q-field>
</div>
<div
@@ -457,7 +457,7 @@
:src="
col.showpicprofile_ifnotset
? userStore.getImgByProfile(row['profile'], true)
: 'images/noimg-user.svg'
: '/images/noimg-user.svg'
"
class="text-center"
style="height: 100px; width: 100px"
@@ -525,7 +525,7 @@
:src="
col.showpicprofile_ifnotset
? userStore.getImgByProfile(row['profile'], true)
: 'images/noimg-user.svg'
: '/images/noimg-user.svg'
"
class="text-center"
style="height: 100px; width: 100px"
@@ -581,7 +581,7 @@
:src="
col.showpicprofile_ifnotset
? userStore.getImgByProfile(row['profile'], true)
: 'images/noimg-user.svg'
: '/images/noimg-user.svg'
"
class="text-center"
style="height: 100px; width: 100px"
@@ -1276,7 +1276,7 @@
@changeval="changevalRecHours"
style="max-width: 100px"
:options="tools.SelectHours"
:addstrrequired="addstrrequired"
:addstrrequired="addstrrequired"
>
</CMySelect>
</div>

View File

@@ -116,7 +116,7 @@
<q-chip>
<q-avatar v-if="getWhereIcon(myevent.wherecode)">
<img
:src="`images/avatar/` + getWhereIcon(myevent.wherecode)"
:src="`/images/avatar/` + getWhereIcon(myevent.wherecode)"
alt="località">
</q-avatar>
<q-avatar

View File

@@ -11,7 +11,7 @@
<q-card-section class="text-center inset-shadow">
<div class="column justify-center" style="min-width: 280px">
<q-img
:src="`images/` + myop.img" class="img_effetto_3d" :alt="`${myop.name} ${myop.surname}`">
:src="`/images/` + myop.img" class="img_effetto_3d" :alt="`${myop.name} ${myop.surname}`">
</q-img>
<div class="title_shadow">{{ myop.name }} {{ myop.surname ? myop.surname : '' }}</div>

View File

@@ -23,7 +23,7 @@ export default defineComponent({
const autoplaydiscsaved = ref(0)
const tab = ref('one')
const mydir = ref('images/')
const mydir = ref('/images/')
watch(() => showuserdetails, (value: any, old: any) => {
if (!showuserdetails.value) {

View File

@@ -7,7 +7,7 @@
<q-carousel animated :autoplay="animare" swipeable infinite navigation transition-next="slide-left"
transition-prev="slide-right" v-model="slide" height="100%" width="100%">
<q-carousel-slide name="first"
:img-src="$q.dark.isActive ? `images/riso_home_dark.png` : `images/riso_home.png`" class="carousel_img_3">
:img-src="$q.dark.isActive ? `/images/riso_home_dark.png` : `/images/riso_home.png`" class="carousel_img_3">
<div class="landing__header"></div>
<div class="landing__hero-content row justify-center q-gutter-xs clgutter">
<div class="row">

View File

@@ -15,7 +15,7 @@ export default function () {
if (event && !!event.img)
return event.img
else
return 'images/noimg.png'
return '/images/noimg.png'
}
function getStyleByEvent(event: IEvents, visu: boolean) {

View File

@@ -1,12 +1,12 @@
import { useCalendarStore } from '@store/CalendarStore'
export default function () {
function isEstate(){
function isEstate() {
const now = new Date()
return (now.getMonth() === 5) || (now.getMonth() === 6) || (now.getMonth() === 7) || (now.getMonth() === 8)
}
function isEstateRiprenderanno(){
function isEstateRiprenderanno() {
const now = new Date()
return (now.getMonth() === 9)
}
@@ -28,7 +28,7 @@ export default function () {
function getImgTeacherByUsername(username: string) {
const calendarStore = useCalendarStore()
return 'images/' + calendarStore.getImgTeacherByUsername(username)
return '/images/' + calendarStore.getImgTeacherByUsername(username)
}
function getTeacherByUsername(username: string) {

View File

@@ -66,7 +66,7 @@ export default function () {
function getMyImg() {
const userStore = useUserStore()
const ris = userStore.getImgByUsername(userStore.my.username)
const out = (ris !== '') ? `${ris}` : 'images/noimg-user.svg'
const out = (ris !== '') ? `${ris}` : '/images/noimg-user.svg'
// console.log('getMyImg = ', out)
return out
}

View File

@@ -6,7 +6,7 @@ import type * as Types from '@src/store/Api/ApiTypes'
// Funzione che smista la richiesta in base al metodo
async function sendRequest(url, method, mydata, myformdata, responsedata, options) {
async function sendRequest(url, method, mydata, myformdata = null, responsedata = null, options = null) {
const actions = {
get: () => Api.get(url, mydata, responsedata),
post: () => Api.post(url, mydata, responsedata, options),

View File

@@ -114,9 +114,9 @@ export const Api = {
} catch (error) {
console.error('Errore durante il refresh token:', error);
// Logout dell'utente in caso di errore critico
userStore.setAuth('', '');
localStorage.removeItem(toolsext.localStorage.token);
localStorage.removeItem(toolsext.localStorage.refreshToken);
// userStore.setAuth('', '');
// localStorage.removeItem(toolsext.localStorage.token);
// localStorage.removeItem(toolsext.localStorage.refreshToken);
throw error;
}
},
@@ -147,15 +147,15 @@ export const Api = {
if (err2?.code === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN) {
userStore.setServerCode(toolsext.ERR_AUTHENTICATION);
// userStore.setAuth('', '');
throw { status: toolsext.ERR_RETRY_LOGIN };
userStore.setAuth('', '');
throw { status: err2.code };
}
// Gestione di altri errori critici
throw err2;
}
} else if (status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN) {
// userStore.setAuth('', '');
userStore.setAuth('', '');
const $router = useRouter()
throw { status: toolsext.ERR_RETRY_LOGIN };
}

View File

@@ -220,7 +220,7 @@ export const costanti = {
to: '/circuits',
table: 'circuits',
icon: 'fas fa-coins',
image: 'images/1ris_rosso_100.png',
image: '/images/1ris_rosso_100.png',
color: 'orange-6',
hint: '',
disable: true,
@@ -488,7 +488,7 @@ export const costanti = {
Nessuno: 0,
Entrata: 1,
Uscita: -1,
},
},
FieldTypeArr: [
{ label: 'Boolean', value: 1 },

View File

@@ -2998,7 +2998,7 @@ export const tools = {
},
getimglogo() {
return `images/${import.meta.env.VITE_LOGO_REG}`
return `/images/${import.meta.env.VITE_LOGO_REG}`
},
consolelogpao(strlog: string, strlog2: any = '', strlog3: any = '') {
@@ -9238,18 +9238,18 @@ export const tools = {
let addtourl = ''
if (!gallerylist) {
return 'images/noimg.png';
return '/images/noimg.png';
}
if (gallerylist && gallerylist.vers_img) {
addtourl = '?v=' + gallerylist.vers_img
}
if (gallerylist && !gallerylist.imagefile) {
return 'images/noimg.png';
return '/images/noimg.png';
}
if (gallerylist) {
if (this.getextfile(gallerylist.imagefile) === 'pdf')
return 'images/images/pdf.jpg'
return '/images/images/pdf.jpg'
else {
if (this.contieneSlash(gallerylist.imagefile)) {
return gallerylist.imagefile + addtourl
@@ -9259,7 +9259,7 @@ export const tools = {
}
} else {
return 'images/noimg.png';
return '/images/noimg.png';
}
},

View File

@@ -424,7 +424,7 @@ export const useUserStore = defineStore('UserStore', {
getImgUserByUsername(username: string): string {
const img = this.getImgByUsername(username)
return img ? img : 'images/noimg-user.svg'
return img ? img : '/images/noimg-user.svg'
},
getImgUserByRow(row: any, col: IColGridTable): string {
@@ -453,7 +453,7 @@ export const useUserStore = defineStore('UserStore', {
}
}
return img ? img : 'images/noimg-user.svg'
return img ? img : '/images/noimg-user.svg'
},
getImgByProfile(userparam: any, reale: any = false, col: any = null): string {
@@ -461,7 +461,7 @@ export const useUserStore = defineStore('UserStore', {
let myrec = this.getRecByCol(userparam, col)
let img = ''
if (!reale)
img = 'images/noimg-user.svg'
img = '/images/noimg-user.svg'
let tipoconto = shared_consts.AccountType.USER
if (col && tools.existProp(col, 'tipoconto') && col.tipoconto) {
@@ -483,7 +483,7 @@ export const useUserStore = defineStore('UserStore', {
//
}
if (!reale)
return 'images/noimg-user.svg'
return '/images/noimg-user.svg'
else
return ''
},
@@ -493,7 +493,7 @@ export const useUserStore = defineStore('UserStore', {
let img = ''
if (!reale)
img = 'images/noimg-user.svg'
img = '/images/noimg-user.svg'
if (tipoconto === shared_consts.AccountType.COLLECTIVE_ACCOUNT) {
img = this.getImgByGroup(from ? mov.groupfrom : mov.groupto)
@@ -512,7 +512,7 @@ export const useUserStore = defineStore('UserStore', {
//
}
if (!reale)
return 'images/noimg-user.svg'
return '/images/noimg-user.svg'
else
return ''
},
@@ -658,7 +658,7 @@ export const useUserStore = defineStore('UserStore', {
return tools.getDirUpload() + 'circuits/' + circ.path + '/' + circ.photos[0].imagefile
} catch (e) {
}
return 'images/noimg.png'
return '/images/noimg.png'
},
getImgByCircuitpath(circuitpath: string): string {
@@ -677,7 +677,7 @@ export const useUserStore = defineStore('UserStore', {
}
} catch (e) {
}
return 'images/noimg.png'
return '/images/noimg.png'
},
getImgByGroupname(groupname: string): string {

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) {