Unverified Commit cb95a802 authored by Ruslan Konviser's avatar Ruslan Konviser Committed by GitHub
Browse files

Merge pull request #1060 from ever-co/fix/#1043-fixed-back-to-previous-location

fix: fixed on back button to go to previous directory
parents d6f18369 2aaa197e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
			<svg
				viewBox="0 0 24 24"
				class="control-icon control-icon-left"
				[routerLink]="['/products/list']"
				(click)="back()"
			>
				<path
					d="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z"
+9 −1
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ import { takeUntil, first } from 'rxjs/operators';
import { ToasterService } from 'angular2-toaster';
import { ProductsCategoryService } from '../../../../@core/data/productsCategory.service';
import 'rxjs/add/operator/switchMap';
import { Location } from '@angular/common';

@Component({
	styleUrls: ['./product-edit.component.scss'],
@@ -24,6 +25,8 @@ export class ProductEditComponent implements OnInit, OnDestroy {
		basicInfo: BasicInfoFormComponent.buildForm(this.formBuilder)
	});

	storeId: string;

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

	protected product$: Observable<Product>;
@@ -39,7 +42,8 @@ export class ProductEditComponent implements OnInit, OnDestroy {
		private readonly productsService: ProductsService,
		private readonly toasterService: ToasterService,
		private readonly router: Router,
		private readonly productsCategoryService: ProductsCategoryService
		private readonly productsCategoryService: ProductsCategoryService,
		private location: Location
	) {
		this.loadProductCategories();
		this.product$ = this.activatedRoute.params.switchMap((p) => {
@@ -84,6 +88,10 @@ export class ProductEditComponent implements OnInit, OnDestroy {
		}
	}

	back() {
		this.location.back();
	}

	ngOnInit(): void {
		this.basicInfoForm.productCategories = this.productsCategories;