diff --git a/src/utils/commons.js b/src/utils/commons.js index c343b05..a17b57a 100644 --- a/src/utils/commons.js +++ b/src/utils/commons.js @@ -571,6 +571,10 @@ export const calcCacheSizes = async () => { } }; +/** + * Clear Browser Cache: Service Worker Cache, HTTP Cache, IndexedDB + * * But keep cookies, local storage, and session storage. + */ export const clearAllCaches = async cb => { try { // 1. Clear the service worker cache diff --git a/src/views/App.jsx b/src/views/App.jsx index 8967b78..7a7449a 100644 --- a/src/views/App.jsx +++ b/src/views/App.jsx @@ -2,7 +2,8 @@ import { Outlet, Link, useHref, useNavigate, NavLink } from 'react-router-dom' import { useEffect, useState } from 'react' import { Popover, Layout, Menu, ConfigProvider, theme, Dropdown, message, FloatButton, Space, Row, Col, Badge, App as AntApp, - Button, Form, Input + Button, Form, Input, + Alert } from 'antd' import { DownOutlined } from '@ant-design/icons' import 'antd/dist/reset.css' @@ -25,6 +26,7 @@ import LogUploader from '@/components/LogUploader' import { PERM_ACCOUNT_MANAGEMENT, PERM_ROLE_NEW, PERM_REVIEW_ALL, PERM_AIR_TICKET, PERM_PRODUCTS_MANAGEMENT,PERM_TRAIN_TICKET, PERM_RESERVATION_ALL, PERM_FEEDBACK_ALL, PERM_INVOICE_ALL, PERM_REPORT_ALL } from '@/config' +import ReloadUpdate from './ReloadUpdate' const { Header, Content, Footer } = Layout @@ -153,7 +155,9 @@ function App() { {needToLogin ? <>login... : } - + diff --git a/src/views/ReloadUpdate.jsx b/src/views/ReloadUpdate.jsx new file mode 100644 index 0000000..ac45d9d --- /dev/null +++ b/src/views/ReloadUpdate.jsx @@ -0,0 +1,15 @@ +import { Button } from 'antd'; +import { clearAllCaches } from '@/utils/commons'; + +const ReloadUpdate = ({ ...props }) => { + const forceReload = async () => { + await clearAllCaches(); + window.location.reload(true); + }; + return ( + + ); +}; +export default ReloadUpdate;