feat: 系统更新按钮

main
Lei OT 5 months ago
parent b65802d074
commit ef2d9ba365

@ -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

@ -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() {
<Content className='p-6 m-0 min-h-72 bg-white overflow-auto'>
{needToLogin ? <>login...</> : <Outlet />}
</Content>
<Footer>China Highlights International Travel Service Co., LTD, Version: {BUILD_VERSION}({GIT_HEAD})</Footer>
<Footer>China Highlights International Travel Service Co., LTD, Version: {BUILD_VERSION}({GIT_HEAD})
<ReloadUpdate />
</Footer>
</Layout>
</ErrorBoundary>
</AntApp>

@ -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 (
<Button type='default' onClick={forceReload} className='ms-2'>
🔃🚀
</Button>
);
};
export default ReloadUpdate;
Loading…
Cancel
Save