Added new interfaces
This commit is contained in:
@@ -1,52 +1,52 @@
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { BackendService, Task, Priority } from '../services/backend.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-task-form',
|
||||
templateUrl: './task-form.component.html',
|
||||
styleUrls: ['./task-form.component.css']
|
||||
})
|
||||
export class TaskFormComponent implements OnInit {
|
||||
|
||||
public title: string;
|
||||
public content: string;
|
||||
public prio: Priority;
|
||||
|
||||
@Input()
|
||||
public task: Task;
|
||||
private submitted: boolean;
|
||||
|
||||
constructor(private backendService: BackendService, private activeModalService: NgbActiveModal) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.task !== null && this.task !== undefined) {
|
||||
this.title = this.task.title;
|
||||
this.content = this.task.content;
|
||||
this.prio = this.task.priority;
|
||||
}
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
if (this.task !== null && this.task !== undefined) {
|
||||
this.task.title = this.title;
|
||||
this.task.content = this.content;
|
||||
this.task.priority = this.prio;
|
||||
this.backendService.putTask(this.task).subscribe(response => {
|
||||
if (response.status > 399) {
|
||||
alert('Fehler');
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.task = { title: this.title, content: this.content, priority: this.prio };
|
||||
this.backendService.postTask(this.task).subscribe(response => {
|
||||
if (response.status > 399) {
|
||||
alert('Fehler');
|
||||
}
|
||||
});
|
||||
}
|
||||
this.submitted = true;
|
||||
this.activeModalService.close();
|
||||
}
|
||||
}
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { BackendService, ScrumTask, Priority } from '../services/backend.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-task-form',
|
||||
templateUrl: './task-form.component.html',
|
||||
styleUrls: ['./task-form.component.css']
|
||||
})
|
||||
export class TaskFormComponent implements OnInit {
|
||||
|
||||
public title: string;
|
||||
public content: string;
|
||||
public prio: Priority;
|
||||
|
||||
@Input()
|
||||
public task: ScrumTask;
|
||||
private submitted: boolean;
|
||||
|
||||
constructor(private backendService: BackendService, private activeModalService: NgbActiveModal) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.task !== null && this.task !== undefined) {
|
||||
this.title = this.task.title;
|
||||
this.content = this.task.content;
|
||||
this.prio = this.task.priority;
|
||||
}
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
if (this.task !== null && this.task !== undefined) {
|
||||
this.task.title = this.title;
|
||||
this.task.content = this.content;
|
||||
this.task.priority = this.prio;
|
||||
this.backendService.putTask(this.task).subscribe(response => {
|
||||
if (response.status > 399) {
|
||||
alert('Fehler');
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.task = { title: this.title, content: this.content, priority: this.prio };
|
||||
this.backendService.postTask(this.task).subscribe(response => {
|
||||
if (response.status > 399) {
|
||||
alert('Fehler');
|
||||
}
|
||||
});
|
||||
}
|
||||
this.submitted = true;
|
||||
this.activeModalService.close();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user