Skip to content

Commit

Permalink
Support /dapps subpath or root (#178)
Browse files Browse the repository at this point in the history
The page now supports being hosted at the root or at the `/dapps`
subpath. Previously it only supported being hosted at the root.
  • Loading branch information
Gudahtt authored Jun 24, 2023
1 parent a09b62b commit 84c0020
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"eject": "react-scripts eject",
"update-changelog": "./scripts/auto-changelog.sh"
},
"homepage": ".",
"eslintConfig": {
"extends": "react-app"
},
Expand Down
5 changes: 4 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ function App() {

if (isLoading) return null

const currentPath = window.location.pathname;
const basename = currentPath.startsWith('/dapps') ? '/dapps' : undefined;

return (
<Router>
<Router basename={basename}>
<ScrollToTop>
<div className="App">
<Route exact path="/" component={Home} />
Expand Down

0 comments on commit 84c0020

Please sign in to comment.