avoid validation errors when clearing the mould
This commit is contained in:
parent
a5af2cc11e
commit
31297d93ae
3 changed files with 11 additions and 10 deletions
|
|
@ -309,7 +309,7 @@
|
|||
? 'block'
|
||||
: 'none'
|
||||
}"
|
||||
(click)="removeTaskData()"
|
||||
(click)="removeTaskData(taskForm)"
|
||||
></app-form-btn>
|
||||
<app-form-btn
|
||||
[class]="'btn-delete'"
|
||||
|
|
|
|||
|
|
@ -180,8 +180,9 @@ export class AddTaskComponent implements OnInit {
|
|||
localStorage.setItem('taskData', JSON.stringify(this.taskData));
|
||||
}
|
||||
|
||||
removeTaskData() {
|
||||
removeTaskData(form: NgForm) {
|
||||
localStorage.removeItem('taskData');
|
||||
this.clearForm(form);
|
||||
this.clearFormData();
|
||||
}
|
||||
|
||||
|
|
@ -189,9 +190,13 @@ export class AddTaskComponent implements OnInit {
|
|||
this.overlayService.setOverlayData('', '');
|
||||
}
|
||||
|
||||
clearForm(form: NgForm) {
|
||||
form.controls['title'].reset();
|
||||
form.controls['description'].reset();
|
||||
form.controls['category'].reset();
|
||||
}
|
||||
|
||||
clearFormData() {
|
||||
this.taskData.title = '';
|
||||
this.taskData.description = '';
|
||||
this.taskData.date = this.currentDate;
|
||||
this.taskData.category = '';
|
||||
this.taskData.assigned = [];
|
||||
|
|
@ -226,7 +231,7 @@ export class AddTaskComponent implements OnInit {
|
|||
if (allowedValues.includes(overlayData)) {
|
||||
const { id, ...taskWithoutId } = this.taskData;
|
||||
this.firebaseService.addNewTask(taskWithoutId);
|
||||
this.removeTaskData();
|
||||
this.removeTaskData(ngForm);
|
||||
this.closeOverlay();
|
||||
} else {
|
||||
if (this.getTaskData(overlayData).length > 0) {
|
||||
|
|
@ -255,8 +260,4 @@ export class AddTaskComponent implements OnInit {
|
|||
this.isAssignedOpen = false;
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.removeTaskData();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
{{ user.firstName }}
|
||||
{{ user.lastName }}
|
||||
@if (user.id === firebaseService.getCurrentUserId()) {
|
||||
<p> {{ "contacts.you" | translate }}</p>
|
||||
{{ "contacts.you" | translate }}
|
||||
}
|
||||
</div>
|
||||
@if(user.uId === "" || user.id === firebaseService.getCurrentUserId()) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue