Skip to content

Commit

Permalink
fix: routing in react-coffee-warehouse
Browse files Browse the repository at this point in the history
  • Loading branch information
silviyaboteva committed Dec 2, 2024
1 parent 4046a76 commit d555c9d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
22 changes: 22 additions & 0 deletions examples/react-coffee-warehouse/public/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>404 page</title>
<script type="text/javascript">
var pathSegmentsToKeep = 2;

var l = window.location;
l.replace(
l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') +
l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' +
l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') +
(l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') +
l.hash
);

</script>
</head>
<body>
</body>
</html>
12 changes: 12 additions & 0 deletions examples/react-coffee-warehouse/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@
/>
<link rel="stylesheet" href="https://unpkg.com/@progress/[email protected]/dist/all.css"></link>
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
<script type="text/javascript">
(function(l) {
if (l.search[1] === '/' ) {
var decoded = l.search.slice(1).split('&').map(function(s) {
return s.replace(/~and~/g, '&')
}).join('?');
window.history.replaceState(null, null,
l.pathname.slice(0, -1) + decoded + l.hash
);
}
}(window.location))
</script>
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand Down

0 comments on commit d555c9d

Please sign in to comment.