| 
									
										
										
										
											2021-07-31 14:45:28 -08:00
										 |  |  | <template> | 
					
						
							| 
									
										
										
										
											2022-06-13 09:33:46 -08:00
										 |  |  |   <v-container> | 
					
						
							| 
									
										
										
										
											2023-11-05 19:07:02 -06:00
										 |  |  |     <RecipeCardSection v-if="user && isOwnGroup" :icon="$globals.icons.heart" :title="$tc('user.user-favorites')" :recipes="user.favoriteRecipes"> | 
					
						
							| 
									
										
										
										
											2022-06-13 09:33:46 -08:00
										 |  |  |     </RecipeCardSection> | 
					
						
							|  |  |  |   </v-container> | 
					
						
							| 
									
										
										
										
											2021-07-31 15:07:19 -08:00
										 |  |  | </template> | 
					
						
							| 
									
										
										
										
											2022-06-13 09:33:46 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | <script lang="ts"> | 
					
						
							|  |  |  | import { defineComponent, useAsync, useRoute } from "@nuxtjs/composition-api"; | 
					
						
							|  |  |  | import RecipeCardSection from "~/components/Domain/Recipe/RecipeCardSection.vue"; | 
					
						
							| 
									
										
										
										
											2023-11-05 19:07:02 -06:00
										 |  |  | import { useLoggedInState } from "~/composables/use-logged-in-state"; | 
					
						
							| 
									
										
										
										
											2022-06-13 09:33:46 -08:00
										 |  |  | import { useUserApi } from "~/composables/api"; | 
					
						
							|  |  |  | import { useAsyncKey } from "~/composables/use-utils"; | 
					
						
							| 
									
										
										
										
											2021-07-31 15:07:19 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | export default defineComponent({ | 
					
						
							| 
									
										
										
										
											2022-06-13 09:33:46 -08:00
										 |  |  |   components: { RecipeCardSection }, | 
					
						
							| 
									
										
										
										
											2021-07-31 15:07:19 -08:00
										 |  |  |   setup() { | 
					
						
							| 
									
										
										
										
											2022-06-13 09:33:46 -08:00
										 |  |  |     const api = useUserApi(); | 
					
						
							|  |  |  |     const route = useRoute(); | 
					
						
							| 
									
										
										
										
											2023-11-05 19:07:02 -06:00
										 |  |  |     const { isOwnGroup } = useLoggedInState(); | 
					
						
							| 
									
										
										
										
											2022-06-13 09:33:46 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     const userId = route.value.params.id; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const user = useAsync(async () => { | 
					
						
							|  |  |  |       const { data } = await api.users.getFavorites(userId); | 
					
						
							|  |  |  |       return data; | 
					
						
							|  |  |  |     }, useAsyncKey()); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return { | 
					
						
							|  |  |  |       user, | 
					
						
							| 
									
										
										
										
											2023-11-05 19:07:02 -06:00
										 |  |  |       isOwnGroup, | 
					
						
							| 
									
										
										
										
											2022-06-13 09:33:46 -08:00
										 |  |  |     }; | 
					
						
							| 
									
										
										
										
											2021-07-31 15:07:19 -08:00
										 |  |  |   }, | 
					
						
							| 
									
										
										
										
											2021-10-07 09:39:47 -08:00
										 |  |  |   head() { | 
					
						
							|  |  |  |     return { | 
					
						
							|  |  |  |       title: this.$t("general.favorites") as string, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   }, | 
					
						
							| 
									
										
										
										
											2021-07-31 15:07:19 -08:00
										 |  |  | }); | 
					
						
							|  |  |  | </script> | 
					
						
							| 
									
										
										
										
											2022-06-13 09:33:46 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | <style scoped></style> |