source: Sources/frontend/src/app/course.service.ts@ 8423429

Last change on this file since 8423429 was 8423429, checked in by AngelNasev <angel.nasev@…>, 15 months ago

Add backend and frontend projects

  • Property mode set to 100644
File size: 743 bytes
RevLine 
[8423429]1import { Injectable } from '@angular/core';
2import {HttpClient} from "@angular/common/http";
3import {Observable} from "rxjs";
4import {CourseInterface} from "./courseInterface";
5
6@Injectable({
7 providedIn: 'root'
8})
9export class CourseService {
10
11 url = "http://localhost:8080/api/courses"
12
13 constructor(private http: HttpClient) {
14 }
15
16 getAllCourses(): Observable<CourseInterface[]> {
17 return this.http.get<CourseInterface[]>(`${this.url}/all`)
18 }
19 findCoursesBySubjectId(id : number) : Observable<CourseInterface[]> {
20 return this.http.get<CourseInterface[]>(`${this.url}/by-subject/${id}`)
21}
22 findCourseById(id :number) : Observable<CourseInterface>{
23 return this.http.get<CourseInterface>(`${this.url}/course/${id}`);
24 }
25}
Note: See TracBrowser for help on using the repository browser.