Skip to content

Commit

Permalink
Merge pull request #1 from ever-co/develop
Browse files Browse the repository at this point in the history
fix: bugs related with Rxjs ever-co#1094
  • Loading branch information
morggansoft authored May 15, 2020
2 parents c49d55b + bd8a80a commit 7c20be1
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ export class CategoriesTableComponent implements OnInit, OnDestroy {
private readonly _modalService: NgbModal,
private readonly _notifyService: NotifyService,
private readonly modalService: NgbModal
) {
this._translateService.setDefaultLang('en');
this._translateService.use('en');
}
) {}

get hasSelectedCategories(): boolean {
return this._selectedCategories.length > 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ export class CategoryCreateComponent implements OnDestroy {
private readonly _translateService: TranslateService,
private readonly _notifyService: NotifyService,
private readonly _productsCategoryService: ProductsCategoryService
) {
this._translateService.setDefaultLang('en');
this._translateService.use('en');
}
) {}

ngOnDestroy() {
this._ngDestroy$.next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Warehouse from '@modules/server.common/entities/Warehouse';
import _ from 'lodash';
import { forkJoin, Observable, Subscription } from 'rxjs';
import { LocalDataSource } from 'ng2-smart-table';
import { Subject } from 'rxjs/Rx';
import { Subject } from 'rxjs';
import { TranslateService } from '@ngx-translate/core';
import { CreatedComponent } from '../../../../@shared/render-component/created/created.component';
import { CarriersOrdersService } from '@app/@core/data/carriers-orders.service';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, OnDestroy, ViewChild, AfterViewInit } from '@angular/core';

import { CarriersService } from '../../@core/data/carriers.service';
import { CarrierMutationComponent } from '../../@shared/carrier/carrier-mutation';
import { Subject } from 'rxjs/Rx';
import { Subject } from 'rxjs';
import { ToasterService } from 'angular2-toaster';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import _ from 'lodash';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { UsersService } from '../../../@core/data/users.service';
import User from '@modules/server.common/entities/User';
import { Observable, Subject } from 'rxjs';
import { first, takeUntil } from 'rxjs/operators';
import { first, takeUntil, switchMap } from 'rxjs/operators';

@Component({
selector: 'ea-customer',
Expand All @@ -24,9 +24,11 @@ export class CustomerComponent implements OnInit, OnDestroy {
) {}

ngOnInit() {
this.user$ = this._router.params.switchMap((p) => {
return this._userService.getUserById(p.id);
});
this.user$ = this._router.params.pipe(
switchMap((p) => {
return this._userService.getUserById(p.id);
})
);

(async () => {
return this.loadUsers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { TranslateService } from '@ngx-translate/core';
import { Observable, forkJoin } from 'rxjs';
import _ from 'lodash';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { Subject } from 'rxjs/Rx';
import { Subject } from 'rxjs';
import { takeUntil, first } from 'rxjs/operators';
import { getCountryName } from '@modules/server.common/entities/GeoLocation';
import { CountryRenderComponent } from './+invites/country-render/country-render.component';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Product from '@modules/server.common/entities/Product';
import { Observable, Subject } from 'rxjs';
import { ActivatedRoute, Router } from '@angular/router';
import { ProductsService } from '../../../../@core/data/products.service';
import { takeUntil, first } from 'rxjs/operators';
import { takeUntil, first, switchMap } from 'rxjs/operators';
import { ToasterService } from 'angular2-toaster';
import { ProductsCategoryService } from '../../../../@core/data/productsCategory.service';
import 'rxjs/add/operator/switchMap';
Expand All @@ -29,7 +29,7 @@ export class ProductEditComponent implements OnInit, OnDestroy {

public readonly basicInfo = this.form.get('basicInfo') as FormControl;

protected product$: Observable<Product>;
protected product$: any;
protected status;
product: any;

Expand All @@ -46,9 +46,12 @@ export class ProductEditComponent implements OnInit, OnDestroy {
private location: Location
) {
this.loadProductCategories();
this.product$ = this.activatedRoute.params.switchMap((p) => {
return this.productsService.getProductById(p.id);
});

this.product$ = this.activatedRoute.params.pipe(
switchMap((p) => {
return this.productsService.getProductById(p.id);
})
);
}

public get isProductValid() {
Expand Down

0 comments on commit 7c20be1

Please sign in to comment.