Skip to content

Commit

Permalink
check dynamically if the user is navigating bat to a hub page
Browse files Browse the repository at this point in the history
  • Loading branch information
marcochavezf committed Feb 16, 2023
1 parent 05a911c commit ac61820
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions docs/assets/js/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/* eslint-disable no-unused-vars */
function toggleHeaderMenu() {
const lhn = document.getElementById('lhn');
Expand All @@ -23,12 +22,12 @@ function toggleHeaderMenu() {
}

function navigateBack() {
if (window.location.pathname.includes('/request-money/')) {
window.location.href = '/hubs/request-money';
} else if (window.location.pathname.includes('/send-money/')) {
window.location.href = '/hubs/send-money';
const hubs = JSON.parse(document.getElementById('hubs-data').value);
const hubToNavigate = hubs.find(hub => window.location.pathname.includes(hub));
if (hubToNavigate) {
window.location.href = `/hubs/${hubToNavigate}`;
} else {
window.location.href = '/hubs/other';
window.location.href = '/';
}

// Add a little delay to avoid showing the previous content in a fraction of a time
Expand Down

0 comments on commit ac61820

Please sign in to comment.