source: bus-n-go-pavel-216049/bus-n-go-frontend/src/app/components/route-instances/route-instance/route-instance.component.ts@ dedbf60

Last change on this file since dedbf60 was baf4cc4, checked in by ppaunovski <paunovskipavel@…>, 4 weeks ago

split group project and individual project into two separate folders

  • Property mode set to 100644
File size: 1.2 KB
Line 
1import {Component, OnInit} from '@angular/core';
2import {ActivatedRoute} from "@angular/router";
3import {RouteInstanceService} from "../../../services/route-instance/route-instance.service";
4import {RouteInstanceResponse} from "../../../model/responses/RouteInstanceResponse";
5import {MatButton} from "@angular/material/button";
6
7@Component({
8 selector: 'app-route-instance',
9 standalone: true,
10 imports: [
11 MatButton
12 ],
13 templateUrl: './route-instance.component.html',
14})
15export class RouteInstanceComponent implements OnInit {
16 routeInstance: RouteInstanceResponse | undefined
17
18 constructor(private route: ActivatedRoute,
19 private routeInstanceService: RouteInstanceService,) {
20 }
21
22 ngOnInit(): void {
23 const routeInstanceId: number = +this.route.snapshot.paramMap.get('id')!
24 this.routeInstanceService.getById(routeInstanceId).subscribe({
25 next: response => {
26 this.routeInstance = response
27 }
28 })
29
30 }
31
32 endInstance() {
33 if (this.routeInstance) {
34 this.routeInstanceService.stop(this.routeInstance.id).subscribe({
35 next: response => {
36 this.routeInstance = response
37 }
38 })
39 }
40 }
41}
Note: See TracBrowser for help on using the repository browser.