Skip to content

Commit

Permalink
fix: catalog path
Browse files Browse the repository at this point in the history
  • Loading branch information
A-Behairi committed Nov 23, 2023
1 parent e48abaf commit b5a5e30
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions pages/_.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ export default {
firstLoadDone: false,
}),
mounted() {
this.iframeSrc = `/stac-browser/${this.$route.hash}`;
this.iframeSrc = this.stacBrowserPath(this.$route.fullPath);
window.addEventListener("message", (evt) => {
if (evt.data && evt.data.navigate && this.firstLoadDone) {
const path =
this.$route.path.at(-1) == "/"
? this.$route.path.slice(0, -1)
: this.$route.path;
history.replaceState({}, null, `${path}/#${evt.data.navigate}`);
const innerPath = evt.data.navigate.replace(".json", "");
history.replaceState(
{},
null,
`${innerPath.length > 1 ? innerPath : "/catalog"}`
);
} else {
this.firstLoadDone = true;
}
Expand All @@ -34,6 +36,10 @@ export default {
prepareEndpoint(src) {
return src.replace("https://", "").replace("http://", "");
},
stacBrowserPath(path) {
let hashPath = path.length > 1 ? path + ".json" : "";
return `/stac-browser/#${hashPath}`;
},
},
};
</script>
Expand Down

0 comments on commit b5a5e30

Please sign in to comment.