mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-24 15:49:42 +02:00
fix recipe static routes
This commit is contained in:
parent
625dbcdea5
commit
8710dad727
11 changed files with 54 additions and 29 deletions
31
frontend/composables/api/static-routes.ts
Normal file
31
frontend/composables/api/static-routes.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
import { useContext } from "@nuxtjs/composition-api";
|
||||
|
||||
export const useStaticRoutes = () => {
|
||||
const { $config } = useContext();
|
||||
|
||||
const prefix = `${$config.SUB_PATH}/api`.replace("//", "/");
|
||||
|
||||
// Methods to Generate reference urls for assets/images *
|
||||
function recipeImage(recipeSlug: string, version = null, key = null) {
|
||||
return `${prefix}/media/recipes/${recipeSlug}/images/original.webp?&rnd=${key}&version=${version}`;
|
||||
}
|
||||
|
||||
function recipeSmallImage(recipeSlug: string, version = null, key = null) {
|
||||
return `${prefix}/media/recipes/${recipeSlug}/images/min-original.webp?&rnd=${key}&version=${version}`;
|
||||
}
|
||||
|
||||
function recipeTinyImage(recipeSlug: string, version = null, key = null) {
|
||||
return `${prefix}/media/recipes/${recipeSlug}/images/tiny-original.webp?&rnd=${key}&version=${version}`;
|
||||
}
|
||||
|
||||
function recipeAssetPath(recipeSlug: string, assetName: string) {
|
||||
return `${prefix}/media/recipes/${recipeSlug}/assets/${assetName}`;
|
||||
}
|
||||
|
||||
return {
|
||||
recipeImage,
|
||||
recipeSmallImage,
|
||||
recipeTinyImage,
|
||||
recipeAssetPath,
|
||||
};
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue