Site Configuration by Server Params (confsites and confpages)

This commit is contained in:
Surya Paolo
2022-11-28 14:00:15 +01:00
parent fab0dbbb72
commit 58dc1dfdcc
76 changed files with 2504 additions and 5004 deletions

View File

@@ -276,7 +276,6 @@ export const useUserStore = defineStore('UserStore', {
if (username === '') return ''
// Check if is this User!
const myrec = this.getUserByUsername(username)
// console.log('myrec', myrec)
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
}
@@ -968,21 +967,24 @@ export const useUserStore = defineStore('UserStore', {
globalStore.checkUpdates()
}
const isok = await globalStore.loadAfterLogin()
this.isLogged = isok && isLogged
console.log('this.isLogged', this.isLogged, 'isok', isok, 'isLogged', isLogged)
// console.log('this.isLogged', this.isLogged, 'isok', isok, 'isLogged', isLogged)
if (static_data.functionality.ENABLE_TODOS_LOADING)
if (globalStore.site.confpages.enableTodos)
await todos.dbLoad({ checkPending: true })
if (static_data.functionality.ENABLE_PROJECTS_LOADING)
if (globalStore.site.confpages.enableProj)
await projects.dbLoad({ checkPending: true, onlyiffirsttime: true })
globalStore.addDynamicPages($router)
static_data.lang_available = globalStore.getLangAvailable()
static_data.arrLangUsed = tools.getLangUsed()
// console.log('$router', $router)
globalStore.finishLoading = true
@@ -1002,7 +1004,7 @@ export const useUserStore = defineStore('UserStore', {
try {
const globalStore = useGlobalStore()
console.log('*** autologin_FromLocalStorage ***')
// console.log('*** autologin_FromLocalStorage ***')
// INIT
let isLogged = false
@@ -1026,77 +1028,11 @@ export const useUserStore = defineStore('UserStore', {
isLogged = tools.isLogged()
}
/*if (token) {
const expirationDateStr = localStorage.getItem(toolsext.localStorage.expirationDate)
const expirationDate = new Date(String(expirationDateStr))
const now = tools.getDateNow()
if (now < expirationDate) {
const _id = String(localStorage.getItem(toolsext.localStorage.userId))
const username = String(localStorage.getItem(toolsext.localStorage.username))
const name = String(localStorage.getItem(toolsext.localStorage.name))
const surname = String(localStorage.getItem(toolsext.localStorage.surname))
const verified_email = localStorage.getItem(toolsext.localStorage.verified_email) === 'true'
const verified_by_aportador = localStorage.getItem(toolsext.localStorage.verified_by_aportador) === 'true'
const made_gift = localStorage.getItem(toolsext.localStorage.made_gift) === 'true'
const myperm = localStorage.getItem(toolsext.localStorage.perm)
let perm = 0
if (myperm) perm = parseInt(myperm, 10)
const img = String(localStorage.getItem(toolsext.localStorage.img))
let teleg_id = 0
const telegid = localStorage.getItem(toolsext.localStorage.teleg_id)
if (telegid) teleg_id = parseInt(telegid, 10)
globalStore.wasAlreadySubOnDb = localStorage.getItem(toolsext.localStorage.wasAlreadySubOnDb) === 'true'
console.log('************* autologin _id', _id)
this.setAuth(token)
this.authUser({
_id,
username,
name,
surname,
verified_email,
verified_by_aportador,
made_gift,
perm,
profile: {
img,
teleg_id,
myshares: [],
friends: [],
req_friends: [],
asked_friends: [],
mygroups: [],
asked_groups: [],
manage_mygroups: []
},
})
isLogged = true
}
}*/
return await this.setGlobal($router, isLogged)
.then((loadstorage: any) => {
console.log('RISULT setGlobal:', loadstorage)
if (loadstorage) {
if ($q.screen.gt.sm) {
// globalStore.setleftDrawerOpen(true)
}
/*if (toolsext.getLocale() !== '') {
// console.log('SETLOCALE :', this.$i18n.locale)
$i18n.locale = toolsext.getLocale() // Set Lang
} else {
userStore.setlang($router, this.$i18n.locale)
}*/
globalroutines('loadapp', '')
// Create Subscription to Push Notification
@@ -1104,9 +1040,6 @@ export const useUserStore = defineStore('UserStore', {
}
})
// console.log('autologin _id STATE ', this._id)
// return true
} catch (e: any) {
console.error('ERR autologin ', e.message)
return false