Skip to content

Commit bda9b68

Browse files
azaslonovalzaslon
andauthored
Added handling for hash part of URL in case of server-side redirect. (#1935)
Co-authored-by: Alexander Zaslonov <alzaslon@microsoft.com>
1 parent 68a0895 commit bda9b68

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/services/aadService.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ export class AadService implements IAadService {
4444
}
4545
}
4646

47-
const returnUrl = this.routeHelper.getQueryParameter("returnUrl") || Constants.pageUrlHome;
47+
const hash = this.router.getHash()
48+
let returnUrl = this.routeHelper.getQueryParameter("returnUrl") || Constants.pageUrlHome;
49+
50+
if (hash) { // special case for server-side redirect when hash part of URL gets discarded
51+
returnUrl += `#${hash}`;
52+
}
4853

4954
this.router.getCurrentUrl() === returnUrl
5055
? location.reload()

src/services/aadServiceV2.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ export class AadServiceV2 implements IAadService {
4444
}
4545
}
4646

47-
const returnUrl = this.routeHelper.getQueryParameter("returnUrl") || Constants.pageUrlHome;
47+
const hash = this.router.getHash()
48+
let returnUrl = this.routeHelper.getQueryParameter("returnUrl") || Constants.pageUrlHome;
49+
50+
if (hash) { // special case for server-side redirect when hash part of URL gets discarded
51+
returnUrl += `#${hash}`;
52+
}
4853

4954
this.router.getCurrentUrl() === returnUrl
5055
? location.reload()

0 commit comments

Comments
 (0)