fix: Refactor Recipe Zip File Flow (#6170)

This commit is contained in:
Michael Genson
2025-11-03 14:43:22 -06:00
committed by GitHub
parent 3d177566ed
commit 0371874670
15 changed files with 81 additions and 125 deletions

View File

@@ -377,11 +377,14 @@ async function deleteRecipe() {
const download = useDownloader();
async function handleDownloadEvent() {
const { data } = await api.recipes.getZipToken(props.slug);
if (data) {
download(api.recipes.getZipRedirectUrl(props.slug, data.token), `${props.slug}.zip`);
const { data: shareToken } = await api.recipes.share.createOne({ recipeId: props.recipeId });
if (!shareToken) {
console.error("No share token received");
alert.error(i18n.t("events.something-went-wrong"));
return;
}
download(api.recipes.share.getZipRedirectUrl(shareToken.id), `${props.slug}.zip`);
}
async function addRecipeToPlan() {