Skip to content

Commit

Permalink
Support running frontend in subdir
Browse files Browse the repository at this point in the history
Setting homepage in package.json is respect by Router and pages that
perform logic on location.pathname
  • Loading branch information
Sean-Der committed Sep 14, 2024
1 parent c930b1a commit c033d6e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion web/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Publish from './components/publish'

function App() {
return (
<BrowserRouter>
<BrowserRouter basename={process.env.PUBLIC_URL}>
<Routes>
<Route path='/' element={<Header />}>
<Route index element={<Selection />} />
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/player/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function Player({ cinemaMode }) {
method: 'POST',
body: offer.sdp,
headers: {
Authorization: `Bearer ${location.pathname.substring(1)}`,
Authorization: `Bearer ${location.pathname.split('/').pop()}`,
'Content-Type': 'application/sdp'
}
}).then(r => {
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/publish/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function Player(props) {
method: 'POST',
body: offer.sdp,
headers: {
Authorization: `Bearer ${location.pathname.substring(1).replace('publish/', '')}`,
Authorization: `Bearer ${location.pathname.split('/').pop()}`,
'Content-Type': 'application/sdp'
}
}).then(r => {
Expand Down

0 comments on commit c033d6e

Please sign in to comment.