fix(pwa): force service worker unregistration to distribute latest fixes
This commit is contained in:
@ -5,6 +5,15 @@ import i18n from './i18n'
|
||||
import './style.css'
|
||||
import App from './App.vue'
|
||||
|
||||
// Force unregister service workers to clear cache for now
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.getRegistrations().then((registrations) => {
|
||||
for (const registration of registrations) {
|
||||
registration.unregister();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const app = createApp(App)
|
||||
const pinia = createPinia()
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<!-- Version info -->
|
||||
<div class="version-info">
|
||||
<p class="app-subtitle">Transporte Público Boquete</p>
|
||||
<p class="app-version">Versión 2.0.0</p>
|
||||
<p class="app-version">Versión 2.0.1</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -48,7 +48,7 @@ onMounted(async () => {
|
||||
const initTimeout = setTimeout(() => {
|
||||
console.warn('Initialization taking too long, forcing navigation...')
|
||||
statusMessage.value = 'Iniciando de todas formas...'
|
||||
navigate()
|
||||
navigate(null, true)
|
||||
}, 3000)
|
||||
|
||||
try {
|
||||
@ -63,13 +63,21 @@ onMounted(async () => {
|
||||
} catch (error) {
|
||||
console.error('Initialization failed', error)
|
||||
clearTimeout(initTimeout)
|
||||
navigate()
|
||||
navigate(null, true)
|
||||
}
|
||||
})
|
||||
|
||||
async function navigate(passedSession?: any) {
|
||||
// Use passed session or fetch if missing
|
||||
const session = passedSession || (await supabase.auth.getSession()).data.session
|
||||
async function navigate(sessionData?: any, force = false) {
|
||||
let session = sessionData;
|
||||
|
||||
if (!session && !force) {
|
||||
try {
|
||||
const resp = await supabase.auth.getSession()
|
||||
session = resp.data.session
|
||||
} catch (e) {
|
||||
console.warn('Silent auth check failed', e)
|
||||
}
|
||||
}
|
||||
|
||||
if (!session) {
|
||||
router.replace('/map')
|
||||
|
||||
Reference in New Issue
Block a user