Skip to content

Commit

Permalink
fix: change facade method for eligible address determination (#1701)
Browse files Browse the repository at this point in the history
  • Loading branch information
skoch-intershop authored Aug 1, 2024
1 parent 5ae95c3 commit 818a32b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/app/core/facades/checkout.facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Store, createSelector, select } from '@ngrx/store';
import { formatISO } from 'date-fns';
import { Subject, combineLatest, merge } from 'rxjs';
import { debounceTime, distinctUntilChanged, map, sample, switchMap, take, tap } from 'rxjs/operators';
import { debounceTime, distinctUntilChanged, filter, map, sample, switchMap, take, tap } from 'rxjs/operators';

import { Address } from 'ish-core/models/address/address.model';
import { Attribute } from 'ish-core/models/attribute/attribute.model';
Expand Down Expand Up @@ -300,9 +300,14 @@ export class CheckoutFacade {
)
);

/**
* Determines the eligible addresses of baskets that have an invoice address.
* This ensures that the basket has at least one address.
*/
eligibleAddresses$() {
return this.basket$.pipe(
whenTruthy(),
filter(basket => basket.invoiceToAddress !== undefined),
take(1),
tap(() => this.store.dispatch(loadBasketEligibleAddresses())),
switchMap(() => this.store.pipe(select(getBasketEligibleAddresses)))
Expand Down

0 comments on commit 818a32b

Please sign in to comment.