This commit is contained in:
2025-05-18 10:48:52 +02:00
parent 505faa95a3
commit f72cc8a802
13 changed files with 153 additions and 11 deletions

View File

@@ -8,11 +8,6 @@ import { Task } from '../models/task';
})
export class TaskService {
private url = 'http://localhost:8080/api';
private headers = {
"access-control-allow-origin": "*",
'Access-Control-Allow-Headers': 'Content-Type, Authorization',
'Access-Control-Allow-Methods': '*',
};
constructor(private http: HttpClient) {}
@@ -20,7 +15,11 @@ export class TaskService {
return this.http.get<Task[]>(`${this.url}/tasks`);
}
getTaskById(taskId: number): Observable<Task> {
return this.http.get<Task>(`${this.url}/task/${taskId}`);
}
createTask(task: Partial<Task>) {
this.http.post(`${this.url}/tasks`, task, { headers: this.headers }).subscribe(t => console.log('TEST: ', t));
this.http.post(`${this.url}/tasks`, task).subscribe();
}
}