Удален файл 404.html и изменен компонент AppProvider для использования HashRouter вместо BrowserRouter, что улучшает совместимость с GitHub Pages.
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Перенаправление</title>
|
||||
<script type="text/javascript">
|
||||
// Перенаправление на index.html с сохранением вложенного пути после /calculator/
|
||||
var l = window.location;
|
||||
var base = '/calculator';
|
||||
// Если уже на index.html — не редиректим!
|
||||
if (!l.pathname.startsWith(base + '/index.html')) {
|
||||
var path = l.pathname.startsWith(base) ? l.pathname.slice(base.length) : l.pathname;
|
||||
var redirectUrl = l.protocol + '//' + l.host + base + '/index.html' + path + l.search + l.hash;
|
||||
window.location.replace(redirectUrl);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<p>Перенаправление на главную страницу...</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +1,5 @@
|
||||
import { FC, ReactNode } from 'react';
|
||||
import { BrowserRouter } from 'react-router-dom';
|
||||
import { HashRouter } from 'react-router-dom';
|
||||
import { Layout, Row, Col } from 'antd';
|
||||
import { AppRouter } from './AppRouter';
|
||||
|
||||
@@ -11,7 +11,7 @@ interface AppProviderProps {
|
||||
|
||||
export const AppProvider: FC<AppProviderProps> = () => {
|
||||
return (
|
||||
<BrowserRouter basename="/calculator/">
|
||||
<HashRouter>
|
||||
<Layout style={{ minHeight: '100vh', background: 'transparent' }}>
|
||||
<Content style={{ padding: 0, width: '100%', margin: 0 }}>
|
||||
<Row justify="center" gutter={[0, 0]} style={{ margin: 0, width: '100%' }}>
|
||||
@@ -21,6 +21,6 @@ export const AppProvider: FC<AppProviderProps> = () => {
|
||||
</Row>
|
||||
</Content>
|
||||
</Layout>
|
||||
</BrowserRouter>
|
||||
</HashRouter>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user