balanced / balanced-dashboard

The Balanced dashboard.
https://dashboard.balancedpayments.com/
Other
2.28k stars 385 forks source link

Redirect to last visited marketplace if marketplace is undefined #1457

Open kyungmin opened 10 years ago

kyungmin commented 10 years ago

It would be nice to be able to deep link into a specific page from external websites (i.e., blog site) so that users can directly get to the page. If marketplace is undefined, we should be able to find the last marketplace the user visited and redirect to the particular page.

mjallday commented 10 years ago

I like the sound of this.

We can cheese it by inspecting the URI and if there's a specific token, replacing it with the most recent marketplace. For example, if we used the token "current" to represent the marketplace when we want it loaded dyanmically:

pseudo code

function loadMarketplace() {
    var uri = document.location;
    var marketplace;
    if (uri.match('^/marketplaces/current')) {
        marketplace = getLastMarketplace();
    } else {
        marketplace = getMarketplaceById();
    }
}

We could expand this a little and have several tokens: