diff --git a/.env.development b/.env.development index 71d31fc..366ac86 100644 --- a/.env.development +++ b/.env.development @@ -1,17 +1,17 @@ -APP_VERSION="0.0.47" -SERVICE_WORKER_FILE='service-worker.js' -APP_ID='1' -APP_URL='https://freeplanet.app' -PROVA_PAOLO='PROVA SVILUPPO' -LANG_DEFAULT='it' -PAO_APP_ID='KKPPAA5KJK435J3KSS9F9D8S9F8SD98F9SDF' -MASTER_KEY='KKPPSS5KJK435J3KSS9F9D8S9F8SD3CR3T' -MONGODB_HOST='http://localhost:3000' +APP_VERSION="0.0.51" +SERVICE_WORKER_FILE="service-worker.js" +APP_ID="1" +APP_URL="https://freeplanet.app" +PROVA_PAOLO="PROVA SVILUPPO" +LANG_DEFAULT="it" +PAO_APP_ID="KKPPAA5KJK435J3KSS9F9D8S9F8SD98F9SDF" +MASTER_KEY="KKPPSS5KJK435J3KSS9F9D8S9F8SD3CR3T" +MONGODB_HOST="http://localhost:3000" LOGO_REG="freeplanet-logo-full.svg" -TEST_EMAIL='paolo.arena77@gmail.com' -TEST_USERNAME='paoloar77' -TEST_PASSWORD='mypassword@1A' -PUBLICKEY_PUSH='BGxRrFWnPoa_ImUaWXmeEOFVI9VNKVKaAPsvsM1XY6wn24yxp9MyOQ4crNYCJKxSXV65Y1GblW5_VLoamedcZ1I' -IN_CONSTRUCTION='0' -DEBUG='1' -TELEGRAM_SUPPORT='https://t.me/freeplanet_supporto' +TEST_EMAIL="paolo.arena77@gmail.com" +TEST_USERNAME="paoloar77" +TEST_PASSWORD="mypassword@1A" +PUBLICKEY_PUSH="BGxRrFWnPoa_ImUaWXmeEOFVI9VNKVKaAPsvsM1XY6wn24yxp9MyOQ4crNYCJKxSXV65Y1GblW5_VLoamedcZ1I" +IN_CONSTRUCTION="0" +DEBUG="1" +TELEGRAM_SUPPORT="https://t.me/freeplanet_supporto" diff --git a/quasar.conf.js b/quasar.conf.js index 4d3dbd5..400a73f 100644 --- a/quasar.conf.js +++ b/quasar.conf.js @@ -185,7 +185,7 @@ module.exports = function (ctx) { iconSet: 'fontawesome-v5', lang: 'it', // Quasar language }, - animations: [], + animations: 'all', ssr: { pwa: { runtimeCaching: [ diff --git a/src/components/Header/Header.ts b/src/components/Header/Header.ts index 3040a58..f92cf19 100644 --- a/src/components/Header/Header.ts +++ b/src/components/Header/Header.ts @@ -227,7 +227,7 @@ export default class Header extends Vue { console.log('this.$q.i18n=', this.$q.i18n, 'this.$q.getLocale()=', this.$q.lang.isoName) const my = this.getLangAtt() - tools.showNotif(this.$q, 'prima: ' + String(my)) + // tools.showNotif(this.$q, 'prima: ' + String(my)) let mylang = tools.getItemLS(tools.localStorage.lang) if (mylang === '') { diff --git a/src/store/Api/Instance.ts b/src/store/Api/Instance.ts index a916607..d755e3f 100644 --- a/src/store/Api/Instance.ts +++ b/src/store/Api/Instance.ts @@ -39,10 +39,10 @@ export const removeAuthHeaders = () => { delete axiosInstance.defaults.headers.Authorization } -async function Request(type: string, path: string, payload: any, setAuthToken?: boolean): Promise { +async function Request(type: string, path: string, payload: any): Promise { let ricevuto = false try { - // console.log(`Axios Request [${type}]:`, axiosInstance.defaults) + console.log(`Axios Request [${type}]:`, axiosInstance.defaults, 'path:', path) let response: AxiosResponse if (type === 'post' || type === 'put' || type === 'patch') { response = await axiosInstance[type](path, payload, { @@ -52,7 +52,7 @@ async function Request(type: string, path: string, payload: any, setAuthToken?: } }) ricevuto = true - // console.log('Request Response: ', response) + console.log('Request Response: ', response) // console.log(new Types.AxiosSuccess(response.data, response.status)) const setAuthToken = (path === '/updatepwd') @@ -109,7 +109,7 @@ async function Request(type: string, path: string, payload: any, setAuthToken?: } } catch (error) { - setTimeout(function () { + setTimeout(() => { GlobalStore.state.connData.uploading_server = (GlobalStore.state.connData.uploading_server === 1) ? -1 : GlobalStore.state.connData.uploading_server GlobalStore.state.connData.downloading_server = (GlobalStore.state.connData.downloading_server === 1) ? -1 : GlobalStore.state.connData.downloading_server }, 1000) diff --git a/src/store/Api/index.ts b/src/store/Api/index.ts index f51b0ae..bcab6bd 100644 --- a/src/store/Api/index.ts +++ b/src/store/Api/index.ts @@ -16,7 +16,6 @@ import router from '@router' import * as Types from '@src/store/Api/ApiTypes' import { costanti } from '@src/store/Modules/costanti' - // const algoliaApi = new AlgoliaSearch() export namespace ApiTool { export async function post(path: string, payload?: any) { @@ -57,7 +56,7 @@ export namespace ApiTool { refresh_token }, { headers: { - 'Authorization': `Bearer ${token}` + Authorization: `Bearer ${token}` } }) } @@ -65,23 +64,22 @@ export namespace ApiTool { export async function SendReq(url: string, method: string, mydata: any, setAuthToken: boolean = false): Promise { UserStore.mutations.setServerCode(tools.EMPTY) UserStore.mutations.setResStatus(0) - return await new Promise(function (resolve, reject) { - + return await new Promise((resolve, reject) => { return sendRequest(url, method, mydata) - .then(res => { + .then((res) => { // console.log('res', res) - setTimeout(function () { - if (method === 'get') + setTimeout(() => { + if (method === 'get') { GlobalStore.state.connData.downloading_server = 0 + } else { GlobalStore.state.connData.uploading_server = 0 GlobalStore.state.connData.downloading_server = 0 } }, 1000) - UserStore.mutations.setResStatus(res.status) if (res.status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN) { // Forbidden @@ -95,10 +93,11 @@ export namespace ApiTool { return resolve(res) }) - .catch(error => { - setTimeout(function () { - if (method === 'get') + .catch((error) => { + setTimeout(() => { + if (method === 'get') { GlobalStore.state.connData.downloading_server = -1 + } else { GlobalStore.state.connData.uploading_server = -1 GlobalStore.state.connData.downloading_server = -1 @@ -114,13 +113,13 @@ export namespace ApiTool { export async function syncAlternative(mystrparam) { // console.log('[ALTERNATIVE Background syncing', mystrparam) - let multiparams = mystrparam.split('|') + const multiparams = mystrparam.split('|') if (multiparams) { if (multiparams.length > 3) { - let cmd = multiparams[0] - let table = multiparams[1] - let method = multiparams[2] - let token = multiparams[3] + const cmd = multiparams[0] + const table = multiparams[1] + const method = multiparams[2] + const token = multiparams[3] // let lang = multiparams[3] if (cmd === 'sync-todos') { @@ -136,17 +135,18 @@ export namespace ApiTool { // console.log('A1) INIZIO.............................................................') return globalroutines(null, 'readall', table, null) - .then(function (alldata) { + .then((alldata) => { const myrecs = [...alldata] // console.log('----------------------- LEGGO QUALCOSA ') - const promises = myrecs.map(rec => { + const promises = myrecs.map((rec) => { // console.log('syncing', table, '', rec.descr) // let link = String(process.env.MONGODB_HOST) + '/todos' let link = '/todos' - if (method !== 'POST') + if (method !== 'POST') { link += '/' + rec._id + } // console.log(' [Alternative] ++++++++++++++++++ SYNCING !!!! ', rec.descr, table, 'FETCH: ', method, link, 'data:') @@ -166,7 +166,7 @@ export namespace ApiTool { .then(() => { return globalroutines(null, 'delete', 'swmsg', null, mystrparam) }) - .catch(function (err) { + .catch((err) => { if (err.message === 'Failed to fetch') { errorfromserver = true } @@ -177,11 +177,11 @@ export namespace ApiTool { // CALL ALL THE PROMISES return Promise.all(promises).then(() => { return (errorfromserver && !lettoqualcosa) - }).catch(err => { + }).catch((err) => { return (errorfromserver && !lettoqualcosa) }) - }).catch(e => { + }).catch((e) => { // console.log('ERROR:', e) return (errorfromserver && !lettoqualcosa) }) @@ -200,6 +200,5 @@ export namespace ApiTool { } } - } export default ApiTool diff --git a/src/store/Modules/GlobalStore.ts b/src/store/Modules/GlobalStore.ts index 6d17355..0d132a2 100644 --- a/src/store/Modules/GlobalStore.ts +++ b/src/store/Modules/GlobalStore.ts @@ -160,7 +160,7 @@ namespace Getters { routes: [ { route: '/', faIcon: 'fa fa-home', materialIcon: 'home', name: 'pages.home' }, { - route: '/todo', faIcon: 'fa fa-list-alt', materialIcon: 'todo', name: 'pages.Todo', + route: '/todo', faIcon: 'fa fa-list-alt', materialIcon: 'format_list_numbered', name: 'pages.Todo', routes2: listatodo }, { route: '/category', faIcon: 'fa fa-list-alt', materialIcon: 'category', name: 'pages.Category' } diff --git a/src/store/Modules/UserStore.ts b/src/store/Modules/UserStore.ts index 24318c1..18ee291 100644 --- a/src/store/Modules/UserStore.ts +++ b/src/store/Modules/UserStore.ts @@ -31,7 +31,6 @@ const state: IUserState = { isAdmin: false } - const b = storeBuilder.module('UserModule', state) const stateGetter = b.state() @@ -40,7 +39,7 @@ namespace Getters { // return state.userInfos.firstname?capitalize(state.userInfos.firstname) + " " + capitalize(state.userInfos.lastname):null; // }) - const lang = b.read(state => { + const lang = b.read((state) => { if (state.lang !== '') { return state.lang } else { @@ -60,11 +59,11 @@ namespace Getters { // } // }, 'tok') - const isServerError = b.read(state => { + const isServerError = b.read((state) => { return (state.servercode === tools.ERR_SERVERFETCH) }, 'isServerError') - const getServerCode = b.read(state => { + const getServerCode = b.read((state) => { return state.servercode }, 'getServerCode') @@ -84,27 +83,27 @@ namespace Getters { // get fullName() { return fullName();}, } - } - namespace Mutations { function authUser(state: IUserState, data: IUserState ) { state.userId = data.userId state.username = data.username - if (data.verified_email) + if (data.verified_email) { state.verified_email = data.verified_email + } - if (data.categorySel) - state.categorySel = data.categorySel // ?? - + if (data.categorySel) { + state.categorySel = data.categorySel + } // ?? resetArrToken(state.tokens) state.tokens.push({ access: 'auth', token: state.x_auth_token, data_login: new Date() }) // ++Todo: Settings Users Admin - if (state.username === 'paoloar77') + if (state.username === 'paoloar77') { state.isAdmin = true + } // console.log('state.tokens', state.tokens) } @@ -144,7 +143,6 @@ namespace Mutations { state.x_auth_token = x_auth_token } - function resetArrToken(arrtokens) { if (!arrtokens.tokens) { arrtokens.tokens = [] @@ -165,7 +163,6 @@ namespace Mutations { state.categorySel = 'personal' } - function setErrorCatch(state: IUserState, axerr: Types.AxiosError) { if (state.servercode !== tools.ERR_SERVERFETCH) { state.servercode = axerr.getCode() @@ -192,7 +189,6 @@ namespace Mutations { return msgerrore } - export const mutations = { authUser: b.commit(authUser), setpassword: b.commit(setpassword), @@ -207,7 +203,6 @@ namespace Mutations { getMsgError: b.commit(getMsgError) } - } namespace Actions { @@ -237,7 +232,7 @@ namespace Actions { Mutations.mutations.setServerCode(tools.CALLING) return await Api.SendReq('/updatepwd', 'POST', usertosend, true) - .then(res => { + .then((res) => { return { code: res.data.code, msg: res.data.msg } }) .catch((error: Types.AxiosError) => { @@ -249,7 +244,7 @@ namespace Actions { async function requestpwd(context, paramquery: IUserState) { - let usertosend = { + const usertosend = { keyappid: process.env.PAO_APP_ID, idapp: process.env.APP_ID, email: paramquery.email @@ -259,7 +254,7 @@ namespace Actions { Mutations.mutations.setServerCode(tools.CALLING) return await Api.SendReq('/requestnewpwd', 'POST', usertosend) - .then(res => { + .then((res) => { return { code: res.data.code, msg: res.data.msg } }).catch((error) => { UserStore.mutations.setErrorCatch(error) @@ -269,7 +264,7 @@ namespace Actions { } async function vreg(context, paramquery: ILinkReg) { - let usertosend = { + const usertosend = { keyappid: process.env.PAO_APP_ID, idapp: process.env.APP_ID, idlink: paramquery.idlink @@ -279,7 +274,7 @@ namespace Actions { Mutations.mutations.setServerCode(tools.CALLING) return await Api.SendReq('/vreg', 'POST', usertosend) - .then(res => { + .then((res) => { // console.log("RITORNO 2 "); // mutations.setServerCode(myres); if (res.data.code === serv_constants.RIS_CODE_EMAIL_VERIFIED) { @@ -300,12 +295,12 @@ namespace Actions { // console.log("PASSW: " + authData.password); - let mylang = state.lang + const mylang = state.lang console.log('MYLANG: ' + mylang) return bcrypt.hash(authData.password, bcrypt.genSaltSync(12)) .then((hashedPassword: string) => { - let usertosend = { + const usertosend = { keyappid: process.env.PAO_APP_ID, lang: mylang, email: authData.email, @@ -319,7 +314,7 @@ namespace Actions { Mutations.mutations.setServerCode(tools.CALLING) return Api.SendReq('/users', 'POST', usertosend) - .then(res => { + .then((res) => { const newuser = res.data @@ -328,8 +323,8 @@ namespace Actions { Mutations.mutations.setServerCode(res.status) if (res.status === 200) { - let userId = newuser._id - let username = authData.username + const userId = newuser._id + const username = authData.username if (process.env.DEV) { console.log('USERNAME = ' + username) console.log('IDUSER= ' + userId) @@ -376,12 +371,12 @@ namespace Actions { try { if ('serviceWorker' in navigator) { sub = await navigator.serviceWorker.ready - .then(function (swreg) { + .then(function(swreg) { console.log('swreg') - let sub = swreg.pushManager.getSubscription() + const sub = swreg.pushManager.getSubscription() return sub }) - .catch(e => { + .catch((e) => { sub = null }) } @@ -406,8 +401,9 @@ namespace Actions { } // console.log('PASSO 4') - if (process.env.DEBUG === '1') + if (process.env.DEBUG === '1') { console.log(usertosend) + } Mutations.mutations.setServerCode(tools.CALLING) @@ -416,7 +412,7 @@ namespace Actions { console.log('Api.SendReq') return Api.SendReq('/users/login', 'POST', usertosend, true) - .then(res => { + .then((res) => { myres = res if (myres.status !== 200) { @@ -424,16 +420,16 @@ namespace Actions { } return myres - }).then(res => { + }).then((res) => { if (res.success) { GlobalStore.mutations.SetwasAlreadySubOnDb(res.data.subsExistonDb) - let myuser: IUserState = res.data.usertosend + const myuser: IUserState = res.data.usertosend if (myuser) { - let userId = myuser.userId - let username = authData.username - let verified_email = myuser.verified_email + const userId = myuser.userId + const username = authData.username + const verified_email = myuser.verified_email Mutations.mutations.authUser({ userId, @@ -458,7 +454,7 @@ namespace Actions { return tools.OK - }).then(code => { + }).then((code) => { if (code === tools.OK) { return setGlobal(true) .then(() => { @@ -491,14 +487,14 @@ namespace Actions { await GlobalStore.actions.clearDataAfterLogout() - let usertosend = { + const usertosend = { keyappid: process.env.PAO_APP_ID, idapp: process.env.APP_ID } console.log(usertosend) const riscall = await Api.SendReq('/users/me/token', 'DELETE', usertosend) - .then(res => { + .then((res) => { console.log(res) }).then(() => { Mutations.mutations.clearAuthData() @@ -525,7 +521,6 @@ namespace Actions { }) } - async function autologin_FromLocalStorage(context) { try { // console.log('*** autologin_FromLocalStorage ***') @@ -538,7 +533,7 @@ namespace Actions { return false } const expirationDateStr = localStorage.getItem(tools.localStorage.expirationDate) - let expirationDate = new Date(String(expirationDateStr)) + const expirationDate = new Date(String(expirationDateStr)) const now = new Date() if (now >= expirationDate) { console.log('!!! Login Expired') @@ -571,7 +566,6 @@ namespace Actions { } } - export const actions = { autologin_FromLocalStorage: b.dispatch(autologin_FromLocalStorage), logout: b.dispatch(logout), diff --git a/src/views/login/vreg/vreg.css b/src/views/login/vreg/vreg.css deleted file mode 100644 index 227f489..0000000 --- a/src/views/login/vreg/vreg.css +++ /dev/null @@ -1,5 +0,0 @@ -.mypanel { - padding:10px; - margin: 10px; - -} diff --git a/src/views/login/vreg/vreg.scss b/src/views/login/vreg/vreg.scss new file mode 100644 index 0000000..ead1fc8 --- /dev/null +++ b/src/views/login/vreg/vreg.scss @@ -0,0 +1,11 @@ +.mypanel { + padding: 10px; + margin: 10px; + +} + +.mybanner { + font-weight: bold; + font-size: 1.1rem; + text-align: center; +} diff --git a/src/views/login/vreg/vreg.ts b/src/views/login/vreg/vreg.ts index ab836e8..6a73ad5 100644 --- a/src/views/login/vreg/vreg.ts +++ b/src/views/login/vreg/vreg.ts @@ -5,21 +5,21 @@ import { UserStore } from '@store' import { serv_constants } from '../../../store/Modules/serv_constants' -import './vreg.css' +import './vreg.scss' import { ILinkReg } from '../../../model/other' @Component({}) export default class Vreg extends Vue { public risultato: string = '---' public riscode: number = 0 - $t: any + public $t: any constructor() { super() console.log('Vreg constructor...') } - created() { + public created() { console.log('vreg created') this.load() } @@ -36,7 +36,7 @@ export default class Vreg extends Vue { return this.riscode === serv_constants.RIS_CODE_EMAIL_VERIFIED } - load() { + public load() { // console.log('load') let param: ILinkReg param = { idlink: this.$route.query.idlink.toString() } @@ -45,8 +45,7 @@ export default class Vreg extends Vue { .then((ris) => { this.riscode = ris.code this.risultato = ris.msg - console.log('RIS = ') - console.log(ris) + console.log('RIS = ', ris) if (this.verificatook) { setTimeout(() => { diff --git a/src/views/login/vreg/vreg.vue b/src/views/login/vreg/vreg.vue index f23201b..8de5f9a 100644 --- a/src/views/login/vreg/vreg.vue +++ b/src/views/login/vreg/vreg.vue @@ -1,30 +1,37 @@