mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-11-15 00:12:20 -05:00
fix: Refactor Recipe Zip File Flow (#6170)
This commit is contained in:
@@ -470,9 +470,6 @@ export interface RecipeToolSave {
|
||||
householdsWithTool?: string[];
|
||||
groupId: string;
|
||||
}
|
||||
export interface RecipeZipTokenResponse {
|
||||
token: string;
|
||||
}
|
||||
export interface SaveIngredientFood {
|
||||
id?: string | null;
|
||||
name: string;
|
||||
|
||||
@@ -6,9 +6,14 @@ const prefix = "/api";
|
||||
const routes = {
|
||||
shareToken: `${prefix}/shared/recipes`,
|
||||
shareTokenId: (id: string) => `${prefix}/shared/recipes/${id}`,
|
||||
shareTokenIdZip: (id: string) => `${prefix}/recipes/shared/${id}/zip`,
|
||||
};
|
||||
|
||||
export class RecipeShareApi extends BaseCRUDAPI<RecipeShareTokenCreate, RecipeShareToken> {
|
||||
baseRoute: string = routes.shareToken;
|
||||
itemRoute = routes.shareTokenId;
|
||||
|
||||
getZipRedirectUrl(tokenId: string) {
|
||||
return routes.shareTokenIdZip(tokenId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import type {
|
||||
CreateRecipeByUrlBulk,
|
||||
ParsedIngredient,
|
||||
UpdateImageResponse,
|
||||
RecipeZipTokenResponse,
|
||||
RecipeLastMade,
|
||||
RecipeSuggestionQuery,
|
||||
RecipeSuggestionResponse,
|
||||
@@ -46,8 +45,6 @@ const routes = {
|
||||
recipesTimelineEvent: `${prefix}/recipes/timeline/events`,
|
||||
|
||||
recipesRecipeSlug: (recipe_slug: string) => `${prefix}/recipes/${recipe_slug}`,
|
||||
recipesRecipeSlugExport: (recipe_slug: string) => `${prefix}/recipes/${recipe_slug}/exports`,
|
||||
recipesRecipeSlugExportZip: (recipe_slug: string) => `${prefix}/recipes/${recipe_slug}/exports/zip`,
|
||||
recipesRecipeSlugImage: (recipe_slug: string) => `${prefix}/recipes/${recipe_slug}/image`,
|
||||
recipesRecipeSlugAssets: (recipe_slug: string) => `${prefix}/recipes/${recipe_slug}/assets`,
|
||||
|
||||
@@ -182,14 +179,6 @@ export class RecipeAPI extends BaseCRUDAPI<CreateRecipe, Recipe, Recipe> {
|
||||
return await this.requests.post<ParsedIngredient>(routes.recipesParseIngredient, { parser, ingredient });
|
||||
}
|
||||
|
||||
async getZipToken(recipeSlug: string) {
|
||||
return await this.requests.post<RecipeZipTokenResponse>(routes.recipesRecipeSlugExport(recipeSlug), {});
|
||||
}
|
||||
|
||||
getZipRedirectUrl(recipeSlug: string, token: string) {
|
||||
return `${routes.recipesRecipeSlugExportZip(recipeSlug)}?token=${token}`;
|
||||
}
|
||||
|
||||
async updateMany(payload: Recipe[]) {
|
||||
return await this.requests.put<Recipe[]>(routes.recipesBase, payload);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user