Skip to content

Commit

Permalink
Use service hooks.onNavigate from base library
Browse files Browse the repository at this point in the history
Path doesn't need to be set when first route has allowSignedOut
Remove hash after returning from SignInWithToken and noHistory
  • Loading branch information
Sleeckx committed Aug 2, 2016
1 parent 77a8d11 commit 592a85a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Libs/Vidyano/vidyano.ts
Original file line number Diff line number Diff line change
Expand Up @@ -866,10 +866,10 @@ namespace Vidyano {
const returnUrl = Vidyano.cookie("returnUrl", { force: true });
if (returnUrl) {
Vidyano.cookie("returnUrl", null, { force: true });
document.location.hash = "!/" + returnUrl;
this.hooks.onNavigate("#!/" + returnUrl, true);
}
else
document.location.hash = "!/";
this.hooks.onNavigate("#!/", true);

return this._getApplication();
}
Expand Down
10 changes: 6 additions & 4 deletions src/WebComponents/App/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,11 @@ namespace Vidyano.WebComponents {
else
Vidyano.Path.history.replaceState(null, null, path);
}
else
else {
this.path = path;
if (replaceCurrent)
history.pushState("", document.title, window.location.pathname);
}
}

getUrlForPersistentObject(id: string, objectId: string, pu: ProgramUnit = this.programUnit) {
Expand Down Expand Up @@ -624,11 +627,10 @@ namespace Vidyano.WebComponents {
if (initializing)
return;

path = App.stripHashBang(path);
if (path && currentRoute && currentRoute.allowSignedOut)
if (currentRoute && currentRoute.allowSignedOut)
return;

if (!this.service.isSignedIn && !path.startsWith("SignIn")) {
if (!this.service.isSignedIn && !App.stripHashBang(path).startsWith("SignIn")) {
if (this.service.defaultUserName) {
this._setInitializing(true);
this.service.signInUsingDefaultCredentials().then(() => {
Expand Down

0 comments on commit 592a85a

Please sign in to comment.