Merge pull request #1533 from GNS3/bugfix/1436
Some checks failed
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Build / Node ${{ matrix.node }} (14) (push) Has been cancelled
Build / Node ${{ matrix.node }} (16) (push) Has been cancelled
Build / Node ${{ matrix.node }} (18) (push) Has been cancelled

Fix error 404 when editing a project
This commit is contained in:
Jeremy Grossmann 2024-12-23 17:27:07 +07:00 committed by GitHub
commit 2e581c4495
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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