source: Sources/frontend/src/app/add-student-courses.service.ts@ 0e4e3d1

Last change on this file since 0e4e3d1 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
Line 
1import { Injectable } from '@angular/core';
2import {HttpClient, HttpParams} from "@angular/common/http";
3import {Observable} from "rxjs";
4import {StudentCourseInterface} from "./StudentCourseInterface";
5import {ProfessorCourseInterface} from "./ProfessorCourseInterface";
6
7@Injectable({
8 providedIn: 'root'
9})
10export class AddStudentCoursesService {
11
12 url = "http://localhost:8080/api/student-courses/add"
13 urlProf = "http://localhost:8080/api/professor-courses/add"
14
15 constructor(private http: HttpClient) { }
16
17 addCourseToStudent(username: string, selectedCourse: number) :Observable<StudentCourseInterface> {
18 const params = new HttpParams().append('username', username).append("selectedCourse",selectedCourse);
19 return this.http.get<StudentCourseInterface>(this.url, {params: params})
20 }
21
22 addCourseToProfessor(username: string, selectedCourse: number) : Observable<ProfessorCourseInterface> {
23 const params = new HttpParams().append('username', username).append("selectedCourse",selectedCourse);
24 return this.http.get<ProfessorCourseInterface>(this.urlProf, {params: params})
25 }
26}
Note: See TracBrowser for help on using the repository browser.