Skip to content

Commit

Permalink
fix avoidRedirect bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jshimko committed Sep 30, 2015
1 parent febf432 commit e21eb1c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ AccountsTemplates.ensureSignedIn = function(context, redirect) {
});

// redirect settings
AccountsTemplates.avoidDefaultRedirect = true;
AccountsTemplates.avoidRedirect = true;
AccountsTemplates.avoidClearError = true;
AccountsTemplates.redirectToPrevPath = true;

Expand Down Expand Up @@ -93,7 +93,7 @@ AccountsTemplates.linkClick = function(route) {
return;
}
var path = AccountsTemplates.getRoutePath(route);
if (path === '#' || path === FlowRouter.current().path) {
if (path === '#' || AccountsTemplates.avoidRedirect || path === FlowRouter.current().path) {
AccountsTemplates.setState(route);
} else {
Meteor.defer(function() {
Expand Down Expand Up @@ -124,8 +124,8 @@ AccountsTemplates.logout = function() {
};

AccountsTemplates.postSubmitRedirect = function(route) {
if (AccountsTemplates.avoidDefaultRedirect) {
AccountsTemplates.avoidDefaultRedirect = false;
if (AccountsTemplates.avoidRedirect) {
AccountsTemplates.avoidRedirect = false;
if (AccountsTemplates.redirectToPrevPath) {
FlowRouter.redirect(AccountsTemplates.getPrevPath());
}
Expand Down

0 comments on commit e21eb1c

Please sign in to comment.