Skip to content

Commit

Permalink
Fix/double redirect issue (#1922)
Browse files Browse the repository at this point in the history
* double-redirect-issue

* protect double redirect

* Take one

* remove logs

* remove logs

* Remove test data

* fix logic

* 🤖 GITHUB ACTIONS
  • Loading branch information
leomendoza123 authored Mar 30, 2023
1 parent 6c29b50 commit 006249d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/app/guards/authorize.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { GoogleTagManagerService } from '../core/google-tag-manager/google-tag-m
providedIn: 'root',
})
export class AuthorizeGuard implements CanActivateChild {
lastRedirectUrl: string
constructor(
private _user: UserService,
private _router: Router,
Expand Down Expand Up @@ -66,7 +67,10 @@ export class AuthorizeGuard implements CanActivateChild {
}

sendUserToRedirectURL(oauthSession: RequestInfoForm): Observable<boolean> {
this.window.location.href = oauthSession.redirectUrl
if (this.lastRedirectUrl !== oauthSession.redirectUrl) {
this.lastRedirectUrl = oauthSession.redirectUrl
this.window.location.href = oauthSession.redirectUrl
}
return NEVER
}

Expand All @@ -80,6 +84,7 @@ export class AuthorizeGuard implements CanActivateChild {
)

return forkJoin(analyticsReports).pipe(
take(1),
switchMap((value) => {
if (value[0] === undefined && value[1] === undefined) {
return throwError('blocked-analytics')
Expand Down

0 comments on commit 006249d

Please sign in to comment.