import {ActivatedRoute, Router} from "@angular/router";

export class UrlUtils {
  constructor(
    private activatedRoute: ActivatedRoute,
    private router: Router
  ) {
  }

  parseUrlParam(param: string): string {
    return this.activatedRoute.snapshot.paramMap.get(param)
  }

  parseIntUrlParam(param: string): number {
    return parseInt(this.parseUrlParam(param))
  }

  navigateTo(url: string) {
    this.router.navigate([url])
  }
}
