From c02518c207de8472f0b1fec21143bc08dbffc4f8 Mon Sep 17 00:00:00 2001 From: Michael Bromley Date: Thu, 4 Mar 2021 16:09:59 +0100 Subject: [PATCH] feat(admin-ui): PaymentMethod & promotions list update on channel change Relates to #587 --- .../components/promotion-list/promotion-list.component.ts | 7 +++---- .../payment-method-list/payment-method-list.component.ts | 3 +-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/admin-ui/src/lib/marketing/src/components/promotion-list/promotion-list.component.ts b/packages/admin-ui/src/lib/marketing/src/components/promotion-list/promotion-list.component.ts index 2eda0ea840..ec0a5469bd 100644 --- a/packages/admin-ui/src/lib/marketing/src/components/promotion-list/promotion-list.component.ts +++ b/packages/admin-ui/src/lib/marketing/src/components/promotion-list/promotion-list.component.ts @@ -1,14 +1,13 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; -import { EMPTY } from 'rxjs'; -import { switchMap } from 'rxjs/operators'; - import { BaseListComponent } from '@vendure/admin-ui/core'; import { GetPromotionList } from '@vendure/admin-ui/core'; import { NotificationService } from '@vendure/admin-ui/core'; import { DataService } from '@vendure/admin-ui/core'; import { ModalService } from '@vendure/admin-ui/core'; +import { EMPTY } from 'rxjs'; +import { switchMap } from 'rxjs/operators'; @Component({ selector: 'vdr-promotion-list', @@ -29,7 +28,7 @@ export class PromotionListComponent extends BaseListComponent< ) { super(router, route); super.setQueryFn( - (...args: any[]) => this.dataService.promotion.getPromotions(...args), + (...args: any[]) => this.dataService.promotion.getPromotions(...args).refetchOnChannelChange(), data => data.promotions, ); } diff --git a/packages/admin-ui/src/lib/settings/src/components/payment-method-list/payment-method-list.component.ts b/packages/admin-ui/src/lib/settings/src/components/payment-method-list/payment-method-list.component.ts index a6e4311776..1cc32516bf 100644 --- a/packages/admin-ui/src/lib/settings/src/components/payment-method-list/payment-method-list.component.ts +++ b/packages/admin-ui/src/lib/settings/src/components/payment-method-list/payment-method-list.component.ts @@ -1,6 +1,5 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; - import { BaseListComponent } from '@vendure/admin-ui/core'; import { GetPaymentMethodList } from '@vendure/admin-ui/core'; import { DataService } from '@vendure/admin-ui/core'; @@ -18,7 +17,7 @@ export class PaymentMethodListComponent extends BaseListComponent< constructor(private dataService: DataService, router: Router, route: ActivatedRoute) { super(router, route); super.setQueryFn( - (...args: any[]) => this.dataService.settings.getPaymentMethods(...args), + (...args: any[]) => this.dataService.settings.getPaymentMethods(...args).refetchOnChannelChange(), data => data.paymentMethods, ); }