Skip to content

Commit

Permalink
🐞 fix router issue in windows
Browse files Browse the repository at this point in the history
  • Loading branch information
macisi committed Jul 4, 2018
1 parent 0be2e8b commit f01322c
Showing 1 changed file with 29 additions and 14 deletions.
43 changes: 29 additions & 14 deletions app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
import moment from 'moment';
import 'moment/locale/zh-cn';
import { hot } from 'react-hot-loader';
import { Router } from '@reach/router';
import {
LocationProvider,
Router,
createMemorySource,
createHistory,
} from '@reach/router';
import ErrorBoundary from './components/component.errorBoundary/';
import './index.less?no-css-module';
import CommandPalette from './modules/module.command.palette/';
Expand All @@ -25,22 +30,32 @@ import SettingModule from './modules/module.setting/';

moment.locale('zh-cn');

let history;
if (process.env.NODE_ENV === 'development') {
history = createHistory(window);
} else {
const source = createMemorySource('/');
history = createHistory(source);
}

const App = () => (
<ErrorBoundary>
<Controller>
<Router>
<LayoutModule path="/">
<DashboardModule default />
<UploadModule path="upload" />
<ProjectModule path="project" />
<ConfigerModule path="configer" />
<QrCodeModule path="qrcode" />
<ImageProcessModule path="images" />
<UserModule path="user" />
<SettingModule path="setting" />
</LayoutModule>
</Router>
<CommandPalette />
<LocationProvider history={history}>
<Router>
<LayoutModule path="/">
<DashboardModule default />
<UploadModule path="upload" />
<ProjectModule path="project" />
<ConfigerModule path="configer" />
<QrCodeModule path="qrcode" />
<ImageProcessModule path="images" />
<UserModule path="user" />
<SettingModule path="setting" />
</LayoutModule>
</Router>
<CommandPalette />
</LocationProvider>
</Controller>
</ErrorBoundary>
);
Expand Down

0 comments on commit f01322c

Please sign in to comment.