refactor: use nuxt plugin to provide pwa helpers globally (#604)

This commit is contained in:
Daniel Roe 2022-12-28 15:08:03 +01:00 committed by GitHub
parent 73cec49cf0
commit 726a581add
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 23 deletions

View file

@ -1,10 +1,6 @@
<script setup>
import { pwa } from '~/composables/pwa'
</script>
<template>
<div
v-if="pwa.needRefresh"
v-if="$pwa?.needRefresh"
m-2 p5 bg="fade" relative
rounded-lg of-hidden
flex="~ col gap-3"
@ -13,10 +9,10 @@ import { pwa } from '~/composables/pwa'
{{ $t('pwa.title') }}
</h2>
<div flex="~ gap-1">
<button type="button" btn-solid px-4 py-1 text-center text-sm @click="pwa.updateServiceWorker()">
<button type="button" btn-solid px-4 py-1 text-center text-sm @click="$pwa.updateServiceWorker()">
{{ $t('pwa.update') }}
</button>
<button type="button" btn-text filter-saturate-0 px-4 py-1 text-center text-sm @click="pwa.close()">
<button type="button" btn-text filter-saturate-0 px-4 py-1 text-center text-sm @click="$pwa.close()">
{{ $t('pwa.dismiss') }}
</button>
</div>