Skip to content

Commit

Permalink
Fix error 404 when editing a project
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed Dec 23, 2024
1 parent 180c653 commit cddce63
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,18 @@ export class ReadmeEditorComponent implements OnInit {
) {}

ngOnInit() {
this.projectService.getReadmeFile(this.controller, this.project.project_id).subscribe(file => {
if (file) this.markdown = file;
this.projectService.getReadmeFile(this.controller, this.project.project_id).subscribe({
next: (file) => {
if (file) {
this.markdown = file;
}
},
error: (err) => {
if (err.status === 404) {
// File doesn't exist yet, which is fine
this.markdown = '';
}
}
});
}
}

0 comments on commit cddce63

Please sign in to comment.