You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2020/05/21 03:54:45 UTC

[incubator-apisix-dashboard] 01/04: feat: update global

This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a commit to branch feat-layout
in repository https://gitbox.apache.org/repos/asf/incubator-apisix-dashboard.git

commit a1f83670a33fe75087bda958d324adc712594b64
Author: juzhiyuan <jj...@gmail.com>
AuthorDate: Thu May 21 11:38:11 2020 +0800

    feat: update global
---
 src/global.tsx | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/global.tsx b/src/global.tsx
index 4c9014c..f7620c4 100644
--- a/src/global.tsx
+++ b/src/global.tsx
@@ -1,15 +1,15 @@
 import { Button, message, notification } from 'antd';
+
 import React from 'react';
-import { useIntl } from 'umi';
+import { formatMessage } 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(useIntl().formatMessage({ id: 'app.pwa.offline' }));
+    message.warning(formatMessage({ id: 'app.pwa.offline' }));
   });
 
   // Pop up a prompt on the page asking the user if they want to use the latest version
@@ -25,7 +25,7 @@ if (pwa) {
       // Send skip-waiting event to waiting SW with MessageChannel
       await new Promise((resolve, reject) => {
         const channel = new MessageChannel();
-        channel.port1.onmessage = msgEvent => {
+        channel.port1.onmessage = (msgEvent) => {
           if (msgEvent.data.error) {
             reject(msgEvent.data.error);
           } else {
@@ -47,12 +47,12 @@ if (pwa) {
           reloadSW();
         }}
       >
-        {useIntl().formatMessage({ id: 'app.pwa.serviceworker.updated.ok' })}
+        {formatMessage({ id: 'app.pwa.serviceworker.updated.ok' })}
       </Button>
     );
     notification.open({
-      message: useIntl().formatMessage({ id: 'app.pwa.serviceworker.updated' }),
-      description: useIntl().formatMessage({ id: 'app.pwa.serviceworker.updated.hint' }),
+      message: formatMessage({ id: 'app.pwa.serviceworker.updated' }),
+      description: formatMessage({ id: 'app.pwa.serviceworker.updated.hint' }),
       btn,
       key,
       onClose: async () => {},
@@ -62,20 +62,20 @@ if (pwa) {
   // unregister service worker
   const { serviceWorker } = navigator;
   if (serviceWorker.getRegistrations) {
-    serviceWorker.getRegistrations().then(sws => {
-      sws.forEach(sw => {
+    serviceWorker.getRegistrations().then((sws) => {
+      sws.forEach((sw) => {
         sw.unregister();
       });
     });
   }
-  serviceWorker.getRegistration().then(sw => {
+  serviceWorker.getRegistration().then((sw) => {
     if (sw) sw.unregister();
   });
 
   // remove all caches
   if (window.caches && window.caches.keys) {
-    caches.keys().then(keys => {
-      keys.forEach(key => {
+    caches.keys().then((keys) => {
+      keys.forEach((key) => {
         caches.delete(key);
       });
     });