mirror of
https://github.com/SomboChea/ui
synced 2024-11-24 15:04:27 +07:00
refactor: remove getBaseNamePath() and history.ts
This commit is contained in:
parent
795544a14c
commit
ecc4521314
@ -1,8 +0,0 @@
|
|||||||
import { createBrowserHistory } from 'history';
|
|
||||||
import { getBaseNamePath } from './utils/url';
|
|
||||||
|
|
||||||
const history = createBrowserHistory({
|
|
||||||
basename: getBaseNamePath(),
|
|
||||||
});
|
|
||||||
|
|
||||||
export default history;
|
|
@ -2,12 +2,16 @@
|
|||||||
|
|
||||||
import React, { Component, ReactElement } from 'react';
|
import React, { Component, ReactElement } from 'react';
|
||||||
import { Router, Route, Switch } from 'react-router-dom';
|
import { Router, Route, Switch } from 'react-router-dom';
|
||||||
|
import { createBrowserHistory } from 'history';
|
||||||
import { AppContextConsumer, AppStateInterface } from './App/App';
|
import { AppContextConsumer, AppStateInterface } from './App/App';
|
||||||
|
|
||||||
import { asyncComponent } from './utils/asyncComponent';
|
import { asyncComponent } from './utils/asyncComponent';
|
||||||
import history from './history';
|
|
||||||
import Header from './components/Header';
|
import Header from './components/Header';
|
||||||
|
|
||||||
|
const history = createBrowserHistory({
|
||||||
|
basename: window.__VERDACCIO_BASENAME_UI_OPTIONS && window.__VERDACCIO_BASENAME_UI_OPTIONS.url_prefix,
|
||||||
|
});
|
||||||
|
|
||||||
const NotFound = asyncComponent(() => import('./components/NotFound'));
|
const NotFound = asyncComponent(() => import('./components/NotFound'));
|
||||||
const VersionPackage = asyncComponent(() => import('./pages/version/Version'));
|
const VersionPackage = asyncComponent(() => import('./pages/version/Version'));
|
||||||
const HomePage = asyncComponent(() => import('./pages/home'));
|
const HomePage = asyncComponent(() => import('./pages/home'));
|
||||||
|
@ -18,11 +18,3 @@ export function getRegistryURL(): string {
|
|||||||
// Don't add slash if it's not a sub directory
|
// Don't add slash if it's not a sub directory
|
||||||
return `${location.origin}${location.pathname === '/' ? '' : location.pathname}`;
|
return `${location.origin}${location.pathname === '/' ? '' : location.pathname}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getBaseNamePath(): string {
|
|
||||||
return window.__VERDACCIO_BASENAME_UI_OPTIONS && window.__VERDACCIO_BASENAME_UI_OPTIONS.url_prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getRootPath(): string {
|
|
||||||
return window.__VERDACCIO_BASENAME_UI_OPTIONS && window.__VERDACCIO_BASENAME_UI_OPTIONS.base;
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user