Fix error 404 when editing a project

This commit is contained in:
grossmj 2024-12-23 15:44:43 +07:00
parent 180c65351b
commit cddce63e2b
No known key found for this signature in database
GPG Key ID: 1E7DD6DBB53FF3D7

View File

@ -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 = '';
}
}
});
}
}