Last change
on this file since 8423429 was 8423429, checked in by AngelNasev <angel.nasev@…>, 17 months ago |
Add backend and frontend projects
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[8423429] | 1 | import { Injectable } from '@angular/core';
|
---|
| 2 | import {Observable} from "rxjs";
|
---|
| 3 | import {StudentCourseInterface} from "./StudentCourseInterface";
|
---|
| 4 | import {HttpClient, HttpParams} from "@angular/common/http";
|
---|
| 5 | import {ProfessorCourseInterface} from "./ProfessorCourseInterface";
|
---|
| 6 |
|
---|
| 7 | @Injectable({
|
---|
| 8 | providedIn: 'root'
|
---|
| 9 | })
|
---|
| 10 | export class StudentCourseService {
|
---|
| 11 |
|
---|
| 12 | url = "http://localhost:8080/api/student-courses"
|
---|
| 13 | urlProf = "http://localhost:8080/api/professor-courses"
|
---|
| 14 | constructor(private http: HttpClient) { }
|
---|
| 15 |
|
---|
| 16 | getAllStudentCourses(): Observable<StudentCourseInterface[]> {
|
---|
| 17 | return this.http.get<StudentCourseInterface[]>(`${this.url}/all`)
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | getAllCoursesForActiveUserStudent(username:string) : Observable<StudentCourseInterface[]> {
|
---|
| 21 | const params = new HttpParams().append('username', username);
|
---|
| 22 | return this.http.get<StudentCourseInterface[]>(this.url, {params: params})
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | getAllCoursesForActiveUserProfessor(username:string) : Observable<ProfessorCourseInterface[]> {
|
---|
| 26 | const params = new HttpParams().append('username', username);
|
---|
| 27 | return this.http.get<ProfessorCourseInterface[]>(this.urlProf, {params: params})
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.