Skip to content

Commit

Permalink
fix(paypal): browser specific window access (#2605)
Browse files Browse the repository at this point in the history
  • Loading branch information
griest024 committed Nov 18, 2023
1 parent 4a90668 commit 1eb1972
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions libs/paypal/routing/src/effects/express-redirect.effects.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { Injectable } from '@angular/core';
import { DOCUMENT } from '@angular/common';
import {
Inject,
Injectable,
} from '@angular/core';
import {
Actions,
ofType,
Expand All @@ -25,14 +29,15 @@ import {
export class DaffPaypalExpressRedirectEffects<T extends DaffPaypalExpressTokenResponse = DaffPaypalExpressTokenResponse>{
constructor(
private actions$: Actions,
@Inject(DOCUMENT) private document: Document,
) { }

redirectUserToStartUrl$: Observable<Action> = createEffect(() => this.actions$.pipe(
ofType(DaffPaypalActionTypes.GeneratePaypalExpressTokenSuccessAction),
tap((action: DaffGeneratePaypalExpressTokenSuccess<T>) => {
const url = action.payload.urls.start;
if (url) {
window.location.assign(action.payload.urls.start);
this.document.defaultView.location.assign(action.payload.urls.start);
}
}),
switchMap(() => EMPTY),
Expand Down

0 comments on commit 1eb1972

Please sign in to comment.