Skip to content

Commit

Permalink
Merge pull request #69 from AudiusProject/jowlee-ipfs-hosted
Browse files Browse the repository at this point in the history
Relative routing for ipns to work
  • Loading branch information
jowlee authored and michellebrier committed Oct 9, 2023
1 parent b6065b1 commit 49c1e30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/protocol-dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "audius-protocol-dashboard",
"version": "0.1.0",
"private": true,
"homepage": "./",
"dependencies": {
"3box": "^1.22.2",
"@apollo/client": "^3.3.7",
Expand Down
8 changes: 5 additions & 3 deletions packages/protocol-dashboard/src/hooks/useRerouteLegacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ import { useLocation } from 'react-router-dom'
* NOTE: updated the route from the legacy url structure to hash routing.
* ie. /services/service-providers => /#/services/service-providers
*
* NOTE: When switching to being served from ipfs, this needs to be updated for the
* client to be loaded via ipns
* NOTE: After switching to ipfs hosted, we can remove entirely
*/

// -------------------------------- Hooks --------------------------------
export const useRerouteLegacy = () => {
const location = useLocation()
useEffect(() => {
if (window.location.pathname !== '/') {
if (
window.location.pathname !== '/' &&
!window.location.pathname.includes('/ipns')
) {
window.history.replaceState({}, '', `/#${window.location.pathname}`)
}
}, [location])
Expand Down

0 comments on commit 49c1e30

Please sign in to comment.