Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing the confirm window content #410

Merged
merged 1 commit into from
Oct 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion coops-ui/src/registerServiceWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

import { register } from 'register-service-worker'

const confirmWindowText = 'A new version of the BC Registries application is available. \n\n' +
'Select OK to update now, or Cancel to update later. \n\n' +
'Note: Selecting OK will cause unsaved changes to be lost. ' +
'Select Cancel to save your changes and continue using the ' +
'current version of the application. \n\n' +
'The application will automatically update when you close your browser.'

if (process.env.NODE_ENV === 'production') {
register(`${process.env.BASE_URL}service-worker.js`, {
ready () {
Expand All @@ -21,7 +28,7 @@ if (process.env.NODE_ENV === 'production') {
},
updated (registration) {
console.log('New content is available; please refresh.')
let confirmationResult = confirm('New content found! Do you want to reload the app?')
let confirmationResult = confirm(confirmWindowText)
if (confirmationResult) { registration.waiting.postMessage({ action: 'skipWaiting' }) }
},
offline () {
Expand Down