Skip to content

Commit

Permalink
Merge pull request #26 from ucdavis/feature/CTS2
Browse files Browse the repository at this point in the history
Feature/cts2
  • Loading branch information
bsedwards committed Aug 5, 2024
2 parents abf295a + 140aeda commit 1f1d7fc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion VueApp/src/composables/RequireLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ export default function useRequireLogin(to: RouteLocationNormalized) {
const r = await get(baseUrl + "loggedInUser")
if (!r.success || !r.result.userId) {
//if user has not authed, send to VIPER 2.0 login url with this app's home page as the return url
window.location.href = import.meta.env.VITE_VIPER_HOME + "login?ReturnUrl=" + to.fullPath//import.meta.env.VITE_VIPER_HOME + appBase + "/"
//application base will be "" on dev and "/2" on prod and test
//to.fullPath will be e.g. /area/page and on test and prod we need /2/area/page as the return url
const applicationBase = (import.meta.env.VITE_VIPER_HOME.length == 1
? ""
: import.meta.env.VITE_VIPER_HOME.substring(0, import.meta.env.VITE_VIPER_HOME.length - 1))
window.location.href = import.meta.env.VITE_VIPER_HOME + "login?ReturnUrl=" + applicationBase + to.fullPath
}
else {
//store the logged in user info
Expand Down

0 comments on commit 1f1d7fc

Please sign in to comment.