Se la window viene attivata, e se sono in fase di registrazione, allora controllo se ci sono aggiornamenti ogni 10 secondi, loadSite
Corretto che il link di registrazione se era in minuscolo l'username e venivi registrato in maiuscolo, non lo prendeva. L'immagine di telegram occorre salvare anche la versione SMALL Corretto filtro, se cambiavo Regione, non mi resettava la Provincia e la Città
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { defineComponent, ref, computed } from 'vue'
|
||||
import { defineComponent, ref, computed, onMounted, watch, onBeforeUnmount } from 'vue'
|
||||
|
||||
import MixinBase from '@src/mixins/mixin-base'
|
||||
import { CCopyBtn } from '../CCopyBtn'
|
||||
@@ -6,6 +6,7 @@ import { useUserStore } from '@store/UserStore'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { useI18n } from '@/boot/i18n'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CVerifyTelegram',
|
||||
@@ -16,7 +17,58 @@ export default defineComponent({
|
||||
const { t } = useI18n()
|
||||
|
||||
const userStore = useUserStore()
|
||||
const $router = useRouter()
|
||||
|
||||
const polling = ref()
|
||||
|
||||
|
||||
watch(() => $q.appVisible, (value: any, oldval: any) => {
|
||||
console.log('visible', value)
|
||||
|
||||
if (value && !oldval) {
|
||||
// console.log('Ora è visibile !')
|
||||
start()
|
||||
}
|
||||
if (!value && oldval) {
|
||||
// console.log('Ora è invisibile !')
|
||||
end()
|
||||
}
|
||||
})
|
||||
|
||||
function refresh() {
|
||||
console.log('refresh')
|
||||
userStore.autologin_FromLocalStorage($router, $q)
|
||||
}
|
||||
|
||||
function load() {
|
||||
start()
|
||||
}
|
||||
|
||||
function start() {
|
||||
refresh()
|
||||
if (tools.notFinishReg()) {
|
||||
if (!polling.value) {
|
||||
polling.value = setInterval(() => {
|
||||
refresh()
|
||||
}, 10000)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function end() {
|
||||
if (polling.value) {
|
||||
clearInterval(polling.value)
|
||||
polling.value = null
|
||||
}
|
||||
}
|
||||
|
||||
function beforeDestroy() {
|
||||
end()
|
||||
}
|
||||
|
||||
onMounted(load)
|
||||
onBeforeUnmount(beforeDestroy)
|
||||
|
||||
return {
|
||||
tools,
|
||||
|
||||
Reference in New Issue
Block a user