Skip to content

Commit

Permalink
parse in go function
Browse files Browse the repository at this point in the history
  • Loading branch information
asnewman committed Dec 26, 2024
1 parent e12c3b5 commit ed2bc01
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,8 @@
this.routes = routes;
this.events = {
...events,
go: (path) => {
go: (rawPath) => {
const path = JSON.parse(rawPath);
const removedSlash = path.startsWith("/") ? path.substring(1) : path;
window.location.hash = `#${removedSlash}`;
}
Expand Down
3 changes: 2 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class Ash {
this.routes = routes;
this.events = {
...events,
go: (path) => {
go: (rawPath) => {
const path = JSON.parse(rawPath)
const removedSlash = path.startsWith("/") ? path.substring(1) : path;
window.location.hash = `#${removedSlash}`;
},
Expand Down

0 comments on commit ed2bc01

Please sign in to comment.