mirror of
https://github.com/uetchy/namae.git
synced 2025-07-02 14:20:03 +09:00
fix(sw): show update notification
This commit is contained in:
parent
f95f8ef551
commit
8f3716b4d5
@ -33,6 +33,7 @@
|
|||||||
"react-router-dom": "^5.1.2",
|
"react-router-dom": "^5.1.2",
|
||||||
"react-scripts": "3.4.1",
|
"react-scripts": "3.4.1",
|
||||||
"react-spinners": "^0.8.1",
|
"react-spinners": "^0.8.1",
|
||||||
|
"react-toastify": "^6.0.5",
|
||||||
"styled-components": "^5.1.0",
|
"styled-components": "^5.1.0",
|
||||||
"validator": "^13.1.0",
|
"validator": "^13.1.0",
|
||||||
"whois-json": "^2.0.4"
|
"whois-json": "^2.0.4"
|
||||||
|
@ -3,6 +3,8 @@ import ReactDOM from 'react-dom';
|
|||||||
import {Router} from 'react-router-dom';
|
import {Router} from 'react-router-dom';
|
||||||
import {StoreProvider} from 'easy-peasy';
|
import {StoreProvider} from 'easy-peasy';
|
||||||
import {createBrowserHistory} from 'history';
|
import {createBrowserHistory} from 'history';
|
||||||
|
import {ToastContainer, toast} from 'react-toastify';
|
||||||
|
import 'react-toastify/dist/ReactToastify.css';
|
||||||
|
|
||||||
import App from './App';
|
import App from './App';
|
||||||
import * as serviceWorker from './serviceWorker';
|
import * as serviceWorker from './serviceWorker';
|
||||||
@ -29,16 +31,26 @@ ReactDOM.render(
|
|||||||
<App />
|
<App />
|
||||||
</Router>
|
</Router>
|
||||||
</FullScreenSuspense>
|
</FullScreenSuspense>
|
||||||
|
<ToastContainer />
|
||||||
</StoreProvider>,
|
</StoreProvider>,
|
||||||
document.getElementById('root'),
|
document.getElementById('root'),
|
||||||
);
|
);
|
||||||
|
|
||||||
serviceWorker.register({
|
serviceWorker.register({
|
||||||
onUpdate: (registration) => {
|
onUpdate: (registration) => {
|
||||||
console.log('New version available! Ready to update?');
|
console.log('Update available');
|
||||||
|
|
||||||
|
toast.dark('New version available! Click here to update.', {
|
||||||
|
onClose: () => {
|
||||||
|
window.location.reload();
|
||||||
|
},
|
||||||
|
position: 'top-right',
|
||||||
|
autoClose: false,
|
||||||
|
closeButton: false,
|
||||||
|
closeOnClick: true,
|
||||||
|
});
|
||||||
if (registration && registration.waiting) {
|
if (registration && registration.waiting) {
|
||||||
registration.waiting.postMessage({type: 'SKIP_WAITING'});
|
registration.waiting.postMessage({type: 'SKIP_WAITING'});
|
||||||
}
|
}
|
||||||
window.location.reload();
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
36
yarn.lock
36
yarn.lock
@ -995,6 +995,13 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
regenerator-runtime "^0.13.4"
|
regenerator-runtime "^0.13.4"
|
||||||
|
|
||||||
|
"@babel/runtime@^7.8.7":
|
||||||
|
version "7.10.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.10.2.tgz#d103f21f2602497d38348a32e008637d506db839"
|
||||||
|
integrity sha512-6sF3uQw2ivImfVIl62RZ7MXhO2tap69WeWK57vAaimT6AZbE4FbqjdEJIN1UqoD6wI6B+1n9UiagafH1sxjOtg==
|
||||||
|
dependencies:
|
||||||
|
regenerator-runtime "^0.13.4"
|
||||||
|
|
||||||
"@babel/template@^7.4.0", "@babel/template@^7.8.3", "@babel/template@^7.8.6":
|
"@babel/template@^7.4.0", "@babel/template@^7.8.3", "@babel/template@^7.8.6":
|
||||||
version "7.8.6"
|
version "7.8.6"
|
||||||
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.8.6.tgz#86b22af15f828dfb086474f964dcc3e39c43ce2b"
|
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.8.6.tgz#86b22af15f828dfb086474f964dcc3e39c43ce2b"
|
||||||
@ -3970,7 +3977,7 @@ cssstyle@^1.0.0, cssstyle@^1.1.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
cssom "0.3.x"
|
cssom "0.3.x"
|
||||||
|
|
||||||
csstype@^2.2.0, csstype@^2.5.7:
|
csstype@^2.2.0, csstype@^2.5.7, csstype@^2.6.7:
|
||||||
version "2.6.10"
|
version "2.6.10"
|
||||||
resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.10.tgz#e63af50e66d7c266edb6b32909cfd0aabe03928b"
|
resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.10.tgz#e63af50e66d7c266edb6b32909cfd0aabe03928b"
|
||||||
integrity sha512-D34BqZU4cIlMCY93rZHbrq9pjTAQJ3U8S8rfBqjwHxkGPThWFjzZDQpgMJY0QViLxth6ZKYiwFBo14RdN44U/w==
|
integrity sha512-D34BqZU4cIlMCY93rZHbrq9pjTAQJ3U8S8rfBqjwHxkGPThWFjzZDQpgMJY0QViLxth6ZKYiwFBo14RdN44U/w==
|
||||||
@ -4278,6 +4285,14 @@ dom-converter@^0.2:
|
|||||||
dependencies:
|
dependencies:
|
||||||
utila "~0.4"
|
utila "~0.4"
|
||||||
|
|
||||||
|
dom-helpers@^5.0.1:
|
||||||
|
version "5.1.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-5.1.4.tgz#4609680ab5c79a45f2531441f1949b79d6587f4b"
|
||||||
|
integrity sha512-TjMyeVUvNEnOnhzs6uAn9Ya47GmMo3qq7m+Lr/3ON0Rs5kHvb8I+SQYjLUSYn7qhEm0QjW0yrBkvz9yOrwwz1A==
|
||||||
|
dependencies:
|
||||||
|
"@babel/runtime" "^7.8.7"
|
||||||
|
csstype "^2.6.7"
|
||||||
|
|
||||||
dom-serializer@0:
|
dom-serializer@0:
|
||||||
version "0.2.2"
|
version "0.2.2"
|
||||||
resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.2.2.tgz#1afb81f533717175d478655debc5e332d9f9bb51"
|
resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.2.2.tgz#1afb81f533717175d478655debc5e332d9f9bb51"
|
||||||
@ -10077,6 +10092,25 @@ react-spinners@^0.8.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@emotion/core" "^10.0.15"
|
"@emotion/core" "^10.0.15"
|
||||||
|
|
||||||
|
react-toastify@^6.0.5:
|
||||||
|
version "6.0.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/react-toastify/-/react-toastify-6.0.5.tgz#6435b2bf6a298863bc71342dcc88e8283cdb4630"
|
||||||
|
integrity sha512-1YXSb6Jr478c1TJEyVpxLHFvtmeXGMvdpZc0fke/7lK+MoLBC+NFgB74bq+C2SZe6LdK+K1voEURJoY88WqWvA==
|
||||||
|
dependencies:
|
||||||
|
classnames "^2.2.6"
|
||||||
|
prop-types "^15.7.2"
|
||||||
|
react-transition-group "^4.4.1"
|
||||||
|
|
||||||
|
react-transition-group@^4.4.1:
|
||||||
|
version "4.4.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-4.4.1.tgz#63868f9325a38ea5ee9535d828327f85773345c9"
|
||||||
|
integrity sha512-Djqr7OQ2aPUiYurhPalTrVy9ddmFCCzwhqQmtN+J3+3DzLO209Fdr70QrN8Z3DsglWql6iY1lDWAfpFiBtuKGw==
|
||||||
|
dependencies:
|
||||||
|
"@babel/runtime" "^7.5.5"
|
||||||
|
dom-helpers "^5.0.1"
|
||||||
|
loose-envify "^1.4.0"
|
||||||
|
prop-types "^15.6.2"
|
||||||
|
|
||||||
react@^16.13.1:
|
react@^16.13.1:
|
||||||
version "16.13.1"
|
version "16.13.1"
|
||||||
resolved "https://registry.yarnpkg.com/react/-/react-16.13.1.tgz#2e818822f1a9743122c063d6410d85c1e3afe48e"
|
resolved "https://registry.yarnpkg.com/react/-/react-16.13.1.tgz#2e818822f1a9743122c063d6410d85c1e3afe48e"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user