-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: oauth-refacto2 feat: ARA-124 * feat: refactor oauth urls * feat: remember urls feat: ACDC-193 * fix chart
- Loading branch information
1 parent
cbd225b
commit 842e964
Showing
11 changed files
with
176 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
const LAST_ROUTEPATH_KEY = 'LAST_ASKED_ROUTE' | ||
|
||
const RememberUrlService = { | ||
|
||
keepLastUrl (to) { | ||
// We dont register the url in the following cases: | ||
// login/logout is asked | ||
// we're already going to the last saved url | ||
// the / is asked whereas we're coming fron a server redirection | ||
if (to.name === 'login') { | ||
return | ||
} | ||
if (to.name === 'logout') { | ||
return | ||
} | ||
const lastRoute = localStorage.getItem(LAST_ROUTEPATH_KEY) | ||
if (to.path === lastRoute) { | ||
return | ||
} | ||
if (this.redirectAsked()) { | ||
return | ||
} | ||
|
||
// in all other cases, we just register the current asked route | ||
localStorage.setItem(LAST_ROUTEPATH_KEY, to.path) | ||
}, | ||
|
||
resetRedirectAsked () { | ||
window.history.replaceState({}, document.title, window.location.pathname) | ||
}, | ||
|
||
redirectAsked (resetRedirection = false) { | ||
const res = new URLSearchParams(window.location.search).get('spring_redirect') === 'true' | ||
if (resetRedirection) { | ||
this.resetRedirectAsked() | ||
} | ||
return res | ||
}, | ||
|
||
// We dont need to redirect when the target | ||
// is already the asked url | ||
redirectNeeded (redirectPath) { | ||
return redirectPath !== localStorage.getItem(LAST_ROUTEPATH_KEY) | ||
}, | ||
|
||
getRedirectPath () { | ||
return localStorage.getItem(LAST_ROUTEPATH_KEY) | ||
} | ||
|
||
} | ||
|
||
export default RememberUrlService |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters