Skip to content

Commit

Permalink
fix: toast message not accurate
Browse files Browse the repository at this point in the history
The toast message now corresponds to what was copied
  • Loading branch information
StanleyMasinde committed Jan 6, 2025
1 parent b696c82 commit da66a73
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
</section>

<div v-show="toast.show" class="transition ease-in-out duration-[10000] text-center font-semibold border rounded-xl fixed w-full bg-black text-white p-3 opacity-70 bottom-1">
<h1>Manifest copied to clipboard</h1>
<h1>{{ toast.message }}</h1>
</div>
</template>

Expand All @@ -119,17 +119,21 @@ const manifest = reactive({
})
const cacheStrategy = ref('cacheFirst')
const serviceWorkerSkipWaiting = ref(true)
const toast = reactive({ show: false })
const toast = reactive({
show: false,
message: '',
})
const serviceWorkerString = ref('')
// watchers
watch(cacheStrategy, () => {
serviceWorkerString.value = generateServiceWorker()
})
function copyToClipboard(part = 'manifest') {
let textToCopy = JSON.stringify(manifest, null, 2)
toast.message = 'Manifest copied to clipboard'
if (part !== 'manifest') {
toast.message = 'Service worker copied to clipboard'
textToCopy = serviceWorkerString.value
}
Expand Down

0 comments on commit da66a73

Please sign in to comment.