Correction navigation après enregistrement issue
This commit is contained in:
@@ -16,15 +16,35 @@ export class IssueDetail {
|
||||
|
||||
protected issue: IssueEntity = this.buildIssue();
|
||||
protected isEditing = this.route.snapshot.queryParamMap.get('mode') === 'edit';
|
||||
private issueBeforeEdit: IssueEntity | null = null;
|
||||
|
||||
protected toggleEdit(): void {
|
||||
this.isEditing = !this.isEditing;
|
||||
constructor() {
|
||||
if (this.isEditing) {
|
||||
this.issueBeforeEdit = this.cloneIssue(this.issue);
|
||||
}
|
||||
}
|
||||
|
||||
protected startEdit(): void {
|
||||
this.issueBeforeEdit = this.cloneIssue(this.issue);
|
||||
this.isEditing = true;
|
||||
}
|
||||
|
||||
protected cancelEdit(): void {
|
||||
if (this.issueBeforeEdit) {
|
||||
this.issue = this.cloneIssue(this.issueBeforeEdit);
|
||||
}
|
||||
this.isEditing = false;
|
||||
}
|
||||
|
||||
protected saveIssue(): void {
|
||||
this.issuesStore.upsert(this.issue);
|
||||
this.issueBeforeEdit = this.cloneIssue(this.issue);
|
||||
this.isEditing = false;
|
||||
this.router.navigate(['/issues']);
|
||||
this.router.navigate(['/issues', this.issue.id]);
|
||||
}
|
||||
|
||||
private cloneIssue(issue: IssueEntity): IssueEntity {
|
||||
return { ...issue };
|
||||
}
|
||||
|
||||
private buildIssue(): IssueEntity {
|
||||
|
||||
Reference in New Issue
Block a user