feat: fallback to unsplash cover when article contains no image
This commit is contained in:
@@ -22,14 +22,16 @@ export const createNewArticle: MenuEntry = {
|
||||
state.activeState.value = "loading";
|
||||
|
||||
fetchStream("/api/articles/create?url=" + value, (chunk) => {
|
||||
if (chunk.startsWith("id:")) {
|
||||
if (chunk.type === "error") {
|
||||
state.activeState.value = "error";
|
||||
state.loadingText.value = chunk.message;
|
||||
} else if (chunk.type === "finished") {
|
||||
state.loadingText.value = "Finished";
|
||||
setTimeout(() => {
|
||||
window.location.href = "/articles/" +
|
||||
chunk.replace("id:", "").trim();
|
||||
globalThis.location.href = "/articles/" + chunk.url;
|
||||
}, 500);
|
||||
} else {
|
||||
state.loadingText.value = chunk;
|
||||
state.loadingText.value = chunk.message;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user