Skip to content

Commit

Permalink
DRY friendly approach
Browse files Browse the repository at this point in the history
  • Loading branch information
vladfulgeanu committed Aug 5, 2014
1 parent c6fc959 commit e6c49ad
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 0 additions & 3 deletions PlainPost/js/new.js
Expand Up @@ -30,9 +30,6 @@ function initializeApplication() {
var contentElement = document.getElementById("content");
contentElement.addEventListener('keyup', previewMarkdown);

// Save to localStorage the app to redirect to after succesful log in
localStorage["Login:redirect_to_app"] = "PlainPost/new.html";

// Initialize the application
callbacks.pendingLogin();

Expand Down
3 changes: 0 additions & 3 deletions ZeroBin/js/new.js
Expand Up @@ -65,9 +65,6 @@ function initializeApplication() {
var contentElement = document.getElementById("content");
contentElement.addEventListener('keyup', previewMarkdown);

// Save to localStorage the app to redirect to after succesful log in
localStorage["Login:redirect_to_app"] = "ZeroBin/new.html";

// Initialize the application
callbacks.pendingLogin();

Expand Down
7 changes: 7 additions & 0 deletions shared/javascripts/privly-web/new.js
Expand Up @@ -68,6 +68,13 @@ var callbacks = {
* returns from the server.
*/
pendingLogin: function(callback) {

// Save to localStorage the app to redirect to after succesful log in
if(window.location.href.indexOf("ZeroBin") > -1) {
localStorage["Login:redirect_to_app"] = "ZeroBin/new.html";
} else if(window.location.href.indexOf("PlainPost") > -1) {
localStorage["Login:redirect_to_app"] = "PlainPost/new.html";
}

// Set the nav bar to the proper domain
privlyNetworkService.initializeNavigation();
Expand Down

0 comments on commit e6c49ad

Please sign in to comment.