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