|
|
@@ -1,15 +1,16 @@
|
|
|
import { Button, message, notification } from 'antd';
|
|
|
|
|
|
import React from 'react';
|
|
|
-import { formatMessage } from 'umi';
|
|
|
+import { useIntl } from 'umi';
|
|
|
import defaultSettings from '../config/defaultSettings';
|
|
|
|
|
|
const { pwa } = defaultSettings;
|
|
|
+
|
|
|
// if pwa is true
|
|
|
if (pwa) {
|
|
|
// Notify user if offline now
|
|
|
window.addEventListener('sw.offline', () => {
|
|
|
- message.warning(formatMessage({ id: 'app.pwa.offline' }));
|
|
|
+ message.warning(useIntl().formatMessage({ id: 'app.pwa.offline' }));
|
|
|
});
|
|
|
|
|
|
// Pop up a prompt on the page asking the user if they want to use the latest version
|
|
|
@@ -47,12 +48,12 @@ if (pwa) {
|
|
|
reloadSW();
|
|
|
}}
|
|
|
>
|
|
|
- {formatMessage({ id: 'app.pwa.serviceworker.updated.ok' })}
|
|
|
+ {useIntl().formatMessage({ id: 'app.pwa.serviceworker.updated.ok' })}
|
|
|
</Button>
|
|
|
);
|
|
|
notification.open({
|
|
|
- message: formatMessage({ id: 'app.pwa.serviceworker.updated' }),
|
|
|
- description: formatMessage({ id: 'app.pwa.serviceworker.updated.hint' }),
|
|
|
+ message: useIntl().formatMessage({ id: 'app.pwa.serviceworker.updated' }),
|
|
|
+ description: useIntl().formatMessage({ id: 'app.pwa.serviceworker.updated.hint' }),
|
|
|
btn,
|
|
|
key,
|
|
|
onClose: async () => {},
|