Skip to content

Commit

Permalink
Handler for Window Popstate
Browse files Browse the repository at this point in the history
  • Loading branch information
androolloyd committed May 4, 2020
1 parent 6391d28 commit c87d8db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
12 changes: 6 additions & 6 deletions app/assets/v2/js/pages/dashboard-hackathon.js
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,12 @@
refreshBounties(null, 0, false);
initDOM();
addPopover();
$(window).on('popstate', function(e) {
e.preventDefault();
// we change the url with the panels to ensure if you refresh or get linked here you're being shown what you want
// this is so that we go back to where we got sent here from, townsquare, etc.
window.location = document.referrer;
});
}, 0);
},
methods: {
Expand Down Expand Up @@ -908,12 +914,6 @@

history.pushState({}, `${vm.hackathonObj['slug']} - ${newPathName}`, newUrl);

$(window).on('popstate', function(e) {
e.preventDefault();
// we change the url with the panels to ensure if you refresh or get linked here you're being shown what you want
// this is so that we go back to where we got sent here from, townsquare, etc.
window.location = document.referrer;
});
}
},
data: () => ({
Expand Down
7 changes: 6 additions & 1 deletion app/assets/v2/js/pages/profile-tribes.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,12 @@ const loadDynamicScript = (callback, url, id) => {
}
},
mounted() {
console.log('we mounted');
$(window).on('popstate', function(e) {
e.preventDefault();
// we change the url with the panels to ensure if you refresh or get linked here you're being shown what you want
// this is so that we go back to where we got sent here from, townsquare, etc.
window.location = document.referrer;
});
let vm = this;

vm.isLoading = false;
Expand Down

0 comments on commit c87d8db

Please sign in to comment.