mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-31 02:03:35 -04:00 
			
		
		
		
	* simplify context menu * move computed to comp-api * feat: ✨ create share tokens for recipes for sharing recieps to non-users * feat: ✨ shareable recipe links with og tags
		
			
				
	
	
		
			27 lines
		
	
	
		
			586 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			586 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { BaseCRUDAPI } from "~/api/_base";
 | |
| 
 | |
| const prefix = "/api";
 | |
| 
 | |
| const routes = {
 | |
|   shareToken: `${prefix}/shared/recipes`,
 | |
|   shareTokenId: (id: string) => `${prefix}/shared/recipes/${id}`,
 | |
| };
 | |
| 
 | |
| export interface RecipeShareTokenCreate {
 | |
|   recipeId: number;
 | |
|   expiresAt?: Date;
 | |
| }
 | |
| 
 | |
| export interface RecipeShareToken {
 | |
|   recipeId: number;
 | |
|   id: string;
 | |
|   groupId: number;
 | |
|   expiresAt: string;
 | |
|   createdAt: string;
 | |
| }
 | |
| 
 | |
| export class RecipeShareApi extends BaseCRUDAPI<RecipeShareToken, RecipeShareTokenCreate> {
 | |
|   baseRoute: string = routes.shareToken;
 | |
|   itemRoute = routes.shareTokenId;
 | |
| }
 |