feat: Ajout de projet
This commit is contained in:
@@ -39,6 +39,13 @@ export class Home {
|
||||
});
|
||||
|
||||
showGroupForm: boolean = false;
|
||||
|
||||
newProjectForm = new FormGroup({
|
||||
name: new FormControl('', Validators.required),
|
||||
});
|
||||
|
||||
showProjectForm: boolean = false;
|
||||
|
||||
//#endregion
|
||||
|
||||
public ngOnInit(): void {
|
||||
@@ -92,4 +99,20 @@ export class Home {
|
||||
});
|
||||
}
|
||||
|
||||
public toggleProjectForm(): void {
|
||||
this.showProjectForm = !this.showProjectForm;
|
||||
}
|
||||
|
||||
/**
|
||||
* submitProject
|
||||
*/
|
||||
public submitProject() {
|
||||
let response: Observable<Project> = this.projectService.addProject(this.newProjectForm.controls.name.value!);
|
||||
|
||||
response.subscribe(response => {
|
||||
this.projects.update(values => {
|
||||
return [...values, response];
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user