|
1 | 1 | import { ChangeDetectionStrategy, Component } from '@angular/core';
|
| 2 | +import { Router } from '@angular/router'; |
| 3 | +import { combineLatest, tap } from 'rxjs'; |
| 4 | + |
| 5 | +import { ROUTER } from '@console-core/config'; |
| 6 | +import { |
| 7 | + filterEmptyAndNullishAndUndefined, |
| 8 | + ShopFacade, |
| 9 | +} from '@console-core/state'; |
2 | 10 |
|
3 | 11 | @Component({
|
4 | 12 | selector: 'app-module-management-shop-index',
|
5 |
| - template: ` <h3>Shopx</h3> `, |
6 |
| - changeDetection: ChangeDetectionStrategy.OnPush, |
| 13 | + template: ` |
| 14 | + @if(vm$ | async; as vm) { |
| 15 | + <h3>Shops</h3> |
| 16 | + } |
| 17 | + `, |
7 | 18 | standalone: false,
|
| 19 | + changeDetection: ChangeDetectionStrategy.OnPush, |
8 | 20 | })
|
9 |
| -export class ShopIndexComponent {} |
| 21 | +export class ShopIndexComponent { |
| 22 | + readonly vm$ = combineLatest({ |
| 23 | + selectedOrganizationId: this.shopFacade.selectedId$.pipe( |
| 24 | + tap((data) => console.log(`data: ${data}`)), |
| 25 | + filterEmptyAndNullishAndUndefined(), |
| 26 | + tap((id) => { |
| 27 | + console.log('view route:'); |
| 28 | + console.log( |
| 29 | + ROUTER.pages.main.children.management.children.shops.children.view.getLink( |
| 30 | + { id } |
| 31 | + ) |
| 32 | + ); |
| 33 | + this.router.navigate( |
| 34 | + ROUTER.pages.main.children.management.children.shops.children.view.getLink( |
| 35 | + { id } |
| 36 | + ) |
| 37 | + ); |
| 38 | + }) |
| 39 | + ), |
| 40 | + }); |
| 41 | + |
| 42 | + constructor( |
| 43 | + private readonly router: Router, |
| 44 | + private readonly shopFacade: ShopFacade |
| 45 | + ) {} |
| 46 | +} |
0 commit comments