PASSAGGIO A VITE !

AGG. 1.1.23
This commit is contained in:
Surya Paolo
2025-03-01 14:14:43 +01:00
parent f0098e57b2
commit bc960d38a1
1044 changed files with 5323 additions and 10823777 deletions

View File

@@ -1,9 +1,8 @@
import { defineStore } from 'pinia'
import {
import type {
ICircuit,
IMyCircuit,
IFriends,
IMsgGlobParam,
ISigninOptions,
ISignupOptions,
@@ -15,16 +14,20 @@ import {
IColGridTable,
ISignupIscrizioneConacreisOptions,
ISignupIscrizioneArcadeiOptions,
ISettings,
IMovQuery,
IMovQuery
} from '@src/model';
import {
IFriends,
ISettings
} from '@src/model'
import { tools } from '@store/Modules/tools'
import { tools } from '@tools'
import translate from '@src/globalroutines/util'
import { ICallResult, ILinkReg, IResult, IToken } from '@model/other'
import type { ILinkReg, IToken } from '@model/other';
import { ICallResult, IResult } from '@model/other'
import objectId from '@src/js/objectId'
import * as Types from '@src/store/Api/ApiTypes'
import type * as Types from '@src/store/Api/ApiTypes'
import { useGlobalStore } from '@store/globalStore'
import { serv_constants } from '@store/Modules/serv_constants'
import { Api } from '@api'
@@ -35,11 +38,12 @@ import { static_data } from '@src/db/static_data'
import bcrypt from 'bcryptjs'
import { useTodoStore } from '@store/Todos'
import { Router } from 'vue-router'
import type { Router } from 'vue-router'
import { useProjectStore } from '@store/Projects'
import { shared_consts } from '@/common/shared_vuejs'
import { shared_consts } from '@src/common/shared_vuejs'
import { costanti } from '@costanti'
import { IReaction, IBookmark, ISeen, IFavBook, IAttend, IFavorite, IGroupShort, IMyGroup, IUserAdmins, IUserShort } from '@model/UserStore'
import type { IReaction, IGroupShort, IMyGroup } from '@model/UserStore';
import { IBookmark, ISeen, IFavBook, IAttend, IFavorite, IUserAdmins, IUserShort } from '@model/UserStore'
import globalroutines from '../globalroutines/index'
import { useNotifStore } from '@store/NotifStore'
@@ -129,7 +133,7 @@ export const DefaultProfile: IUserProfile = {
img: '',
nationality: '',
intcode_cell: '',
cell: process.env.TEST_CELL || '',
cell: '',
dateofbirth: null,
sex: 0,
country_pay: '',
@@ -194,7 +198,7 @@ export const useUserStore = defineStore('UserStore', {
my: { ...DefaultUser },
userprofile: DefaultUser,
groups: [],
lang: process.env.LANG_DEFAULT ? process.env.LANG_DEFAULT : 'it',
lang: import.meta.env.VITE_LANG_DEFAULT ? import.meta.env.VITE_LANG_DEFAULT : 'it',
repeatPassword: '',
categorySel: 'personal',
servercode: 0,
@@ -227,7 +231,7 @@ export const useUserStore = defineStore('UserStore', {
getListaEditori: (state: IUserState) => {
return state.lista_editori
},
getServerCode: (state: IUserState): number => (state.servercode ? state.servercode : 0),
getMsg: (state: IUserState): string => (state.msg ? state.msg : ''),
@@ -409,7 +413,7 @@ export const useUserStore = defineStore('UserStore', {
// Check if is this User!
const myrec = this.getUserByUsername(username)
if (myrec && myrec.profile && !!myrec.profile.img && myrec.profile.img !== '' && myrec.profile.img !== 'undefined') {
return costanti.DIR_UPLOAD + 'profile/' + this.my.username + '/' + myrec.profile.img
return tools.getDirUpload() + 'profile/' + this.my.username + '/' + myrec.profile.img
}
return ''
},
@@ -422,11 +426,11 @@ export const useUserStore = defineStore('UserStore', {
getImgUserByRow(row: any, col: IColGridTable): string {
let value = ''
if (row.hasOwnProperty(col.name)) {
if (tools.existProp(row, col.name)) {
value = row[col.name]
}
let tipoconto = shared_consts.AccountType.USER
if (col.hasOwnProperty('tipoconto') && col.tipoconto) {
if (tools.existProp(col, 'tipoconto') && col.tipoconto) {
tipoconto = col.tipoconto
}
let img = ''
@@ -440,7 +444,7 @@ export const useUserStore = defineStore('UserStore', {
if (row) {
const mycol = col.name + '.img'
if (row.hasOwnProperty(mycol)) {
if (tools.existProp(row, mycol)) {
img = row[mycol]
}
}
@@ -456,7 +460,7 @@ export const useUserStore = defineStore('UserStore', {
img = 'images/noimg-user.svg'
let tipoconto = shared_consts.AccountType.USER
if (col && col.hasOwnProperty('tipoconto') && col.tipoconto) {
if (col && tools.existProp(col, 'tipoconto') && col.tipoconto) {
tipoconto = col.tipoconto
}
@@ -466,7 +470,7 @@ export const useUserStore = defineStore('UserStore', {
img = this.getImgByCircuitpath(myrec.path)
} else {
if (myrec.profile && myrec.profile.img) {
img = costanti.DIR_UPLOAD + 'profile/' + myrec.username + '/' + myrec.profile.img
img = tools.getDirUpload() + 'profile/' + myrec.username + '/' + myrec.profile.img
}
}
@@ -495,7 +499,7 @@ export const useUserStore = defineStore('UserStore', {
} else {
let myuser = from ? mov.userfrom : mov.userto
if (myuser && myuser.profile.img) {
img = costanti.DIR_UPLOAD + 'profile/' + myuser.username + '/' + myuser.profile.img
img = tools.getDirUpload() + 'profile/' + myuser.username + '/' + myuser.profile.img
}
}
@@ -647,7 +651,7 @@ export const useUserStore = defineStore('UserStore', {
try {
if (circ && circ.photos && circ.photos.length > 0)
return costanti.DIR_UPLOAD + 'circuits/' + circ.path + '/' + circ.photos[0].imagefile
return tools.getDirUpload() + 'circuits/' + circ.path + '/' + circ.photos[0].imagefile
} catch (e) {
}
return 'images/noimg.png'
@@ -665,7 +669,7 @@ export const useUserStore = defineStore('UserStore', {
try {
// ++Todo: Sistemare!
if (group) {
return costanti.DIR_UPLOAD + 'mygroups/' + group.groupname + '/' + group.photos[0].imagefile
return tools.getDirUpload() + 'mygroups/' + group.groupname + '/' + group.photos[0].imagefile
}
} catch (e) {
}
@@ -785,7 +789,7 @@ export const useUserStore = defineStore('UserStore', {
let myrec = this.getRecByCol(user, col)
let tipoconto = shared_consts.AccountType.USER
if (col && col.hasOwnProperty('tipoconto')) {
if (col && tools.existProp(col, 'tipoconto')) {
tipoconto = col.tipoconto
}
@@ -802,21 +806,21 @@ export const useUserStore = defineStore('UserStore', {
name = myrec.dest
}
} else if (tipoconto === shared_consts.AccountType.COLLECTIVE_ACCOUNT) {
if (myrec.hasOwnProperty('descr'))
if (tools.existProp(myrec, 'descr'))
return myrec.descr
else if (myrec.hasOwnProperty('groupname'))
else if (tools.existProp(myrec, 'groupname'))
return myrec.groupname
else if (myrec.hasOwnProperty('grouporig'))
else if (tools.existProp(myrec, 'grouporig'))
return myrec.grouporig
} else if (tipoconto === shared_consts.AccountType.COMMUNITY_ACCOUNT) {
if (myrec.hasOwnProperty('name'))
if (tools.existProp(myrec, 'name'))
return myrec.name
else if (myrec.hasOwnProperty('contocom'))
else if (tools.existProp(myrec, 'contocom'))
return myrec.contocom
else if (myrec.hasOwnProperty('contoComDest'))
else if (tools.existProp(myrec, 'contoComDest'))
return myrec.contoComDest
}
if (!name && myrec.extrarec && myrec.extrarec.hasOwnProperty('contoComDest'))
if (!name && tools.existProp(myrec.extrarec, 'contoComDest'))
return myrec.extrarec.contoComDest
return name + (options && options.showprov ? this.getProvinceByUser(myrec, options ? options.html : false) : '')
@@ -835,7 +839,7 @@ export const useUserStore = defineStore('UserStore', {
return mystr
},
getUserNameOnlyIfToShow(user: any, col: any = null, options: any): string {
getUserNameOnlyIfToShow(user: any, col: any = null, options: any = {}): string {
let myrec = this.getRecByCol(user, col)
if (myrec.name || myrec.surname) {
@@ -873,7 +877,7 @@ export const useUserStore = defineStore('UserStore', {
msgerrore = translate('fetch.errore_generico')
}
if (process.env.DEV) {
if (import.meta.env.DEV) {
console.log('ERROREEEEEEEEE: ', msgerrore, ' (', err, ')')
}
}
@@ -1255,8 +1259,8 @@ export const useUserStore = defineStore('UserStore', {
setlang($q: any, router: Router, newstr: string) {
// console.log('SETLANG', newstr)
this.lang = newstr
toolsext.setLangAtt($q, router, newstr)
toolsext.setLangAtt($q, router, newstr)
tools.setLangAtt($q, router, newstr)
tools.setLangAtt($q, router, newstr)
tools.localStSetItem(toolsext.localStorage.lang, this.lang)
},
@@ -1282,7 +1286,7 @@ export const useUserStore = defineStore('UserStore', {
this.setServerCode(res.status)
if (res.status === 200) {
if (process.env.DEV) {
if (import.meta.env.DEV) {
console.log('USERNAME = ' + newuser.username)
console.log('IDUSER= ' + newuser._id)
}
@@ -1423,7 +1427,7 @@ export const useUserStore = defineStore('UserStore', {
options,
}
if (process.env.DEBUG === '1') {
if (import.meta.env.VITE_DEBUG === '1') {
console.log(usertosend)
}
@@ -1541,10 +1545,12 @@ export const useUserStore = defineStore('UserStore', {
await globalStore.checkUpdates()
}
const isok = await globalStore.loadAfterLogin()
const isok = await globalStore.loadLoginSite(router)
this.isLogged = isok && isLogged
await globalStore.loadAfterLogin()
// console.log('this.isLogged', this.isLogged, 'isok', isok, 'isLogged', isLogged)
if (globalStore.site.confpages && globalStore.site.confpages.enableTodos)
@@ -2197,7 +2203,7 @@ export const useUserStore = defineStore('UserStore', {
return false
}
},
async loadListaEditori() {
const globalStore = useGlobalStore();
if (!this.lista_editori) {