| 
									
										
										
										
											2021-07-31 14:00:28 -08:00
										 |  |  | <template> | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |   <v-app v-if="ready"
 | 
					
						
							|  |  |  |          dark | 
					
						
							|  |  |  |   > | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |     <v-card-title> | 
					
						
							|  |  |  |       <slot> | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |         <h1 class="mx-auto"> | 
					
						
							|  |  |  |           {{ $t("page.404-page-not-found") }} | 
					
						
							|  |  |  |         </h1> | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |       </slot> | 
					
						
							|  |  |  |     </v-card-title> | 
					
						
							|  |  |  |     <div class="d-flex justify-space-around"> | 
					
						
							|  |  |  |       <div class="d-flex align-center"> | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |         <p class="primary--text"> | 
					
						
							|  |  |  |           4 | 
					
						
							|  |  |  |         </p> | 
					
						
							|  |  |  |         <v-icon color="primary" | 
					
						
							|  |  |  |                 class="mx-auto mb-0" | 
					
						
							|  |  |  |                 size="200" | 
					
						
							|  |  |  |         > | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |           {{ $globals.icons.primary }} | 
					
						
							|  |  |  |         </v-icon> | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |         <p class="primary--text"> | 
					
						
							|  |  |  |           4 | 
					
						
							|  |  |  |         </p> | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |       </div> | 
					
						
							|  |  |  |     </div> | 
					
						
							|  |  |  |     <v-card-actions> | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |       <v-spacer /> | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |       <slot name="actions"> | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |         <v-btn v-for="(button, index) in buttons"
 | 
					
						
							|  |  |  |                :key="index" | 
					
						
							|  |  |  |                nuxt | 
					
						
							|  |  |  |                :to="button.to" | 
					
						
							|  |  |  |                color="primary" | 
					
						
							|  |  |  |         > | 
					
						
							|  |  |  |           <v-icon start> | 
					
						
							|  |  |  |             {{ button.icon }} | 
					
						
							|  |  |  |           </v-icon> | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |           {{ button.text }} | 
					
						
							|  |  |  |         </v-btn> | 
					
						
							|  |  |  |       </slot> | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |       <v-spacer /> | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |     </v-card-actions> | 
					
						
							| 
									
										
										
										
											2024-04-04 11:56:27 -05:00
										 |  |  |   </v-app> | 
					
						
							| 
									
										
										
										
											2021-07-31 14:00:28 -08:00
										 |  |  | </template> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  | <script lang="ts"> | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  | export default defineNuxtComponent({ | 
					
						
							| 
									
										
										
										
											2021-07-31 14:00:28 -08:00
										 |  |  |   props: { | 
					
						
							|  |  |  |     error: { | 
					
						
							|  |  |  |       type: Object, | 
					
						
							| 
									
										
										
										
											2021-08-01 19:24:47 -08:00
										 |  |  |       default: null, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2021-07-31 14:00:28 -08:00
										 |  |  |   }, | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  |   setup(props) { | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |     definePageMeta({ | 
					
						
							|  |  |  |       layout: "basic", | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const i18n = useI18n(); | 
					
						
							|  |  |  |     const $auth = useMealieAuth(); | 
					
						
							|  |  |  |     const { $globals } = useNuxtApp(); | 
					
						
							| 
									
										
										
										
											2023-11-05 19:07:02 -06:00
										 |  |  |     const ready = ref(false); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const route = useRoute(); | 
					
						
							|  |  |  |     const router = useRouter(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     async function insertGroupSlugIntoRoute() { | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |       const groupSlug = ref($auth.user.value?.groupSlug); | 
					
						
							| 
									
										
										
										
											2023-11-05 19:07:02 -06:00
										 |  |  |       if (!groupSlug.value) { | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       let replaceRoute = false; | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |       let routeVal = route.fullPath || "/"; | 
					
						
							| 
									
										
										
										
											2023-11-05 19:07:02 -06:00
										 |  |  |       if (routeVal[0] !== "/") { | 
					
						
							|  |  |  |         routeVal = `/${routeVal}`; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       // replace "recipe" in URL with "r"
 | 
					
						
							|  |  |  |       if (routeVal.includes("/recipe/")) { | 
					
						
							|  |  |  |         replaceRoute = true; | 
					
						
							|  |  |  |         routeVal = routeVal.replace("/recipe/", "/r/"); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       // insert groupSlug into URL
 | 
					
						
							|  |  |  |       const routeComponents = routeVal.split("/"); | 
					
						
							|  |  |  |       if (routeComponents.length < 2 || routeComponents[1].toLowerCase() !== "g") { | 
					
						
							|  |  |  |         replaceRoute = true; | 
					
						
							|  |  |  |         routeVal = `/g/${groupSlug.value}${routeVal}`; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (replaceRoute) { | 
					
						
							|  |  |  |         await router.replace(routeVal); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-22 10:14:32 -05:00
										 |  |  |     async function handle404() { | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |       const normalizedRoute = route.fullPath.replace(/\/$/, ""); | 
					
						
							| 
									
										
										
										
											2024-08-22 10:14:32 -05:00
										 |  |  |       const newRoute = normalizedRoute.replace(/^\/group\/(mealplan|members|notifiers|webhooks)(\/.*)?$/, "/household/$1$2"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (newRoute !== normalizedRoute) { | 
					
						
							|  |  |  |         await router.replace(newRoute); | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |       } | 
					
						
							|  |  |  |       else { | 
					
						
							| 
									
										
										
										
											2024-08-22 10:14:32 -05:00
										 |  |  |         await insertGroupSlugIntoRoute(); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       ready.value = true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-05 19:07:02 -06:00
										 |  |  |     if (props.error.statusCode === 404) { | 
					
						
							| 
									
										
										
										
											2024-08-22 10:14:32 -05:00
										 |  |  |       handle404(); | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |     } | 
					
						
							|  |  |  |     else { | 
					
						
							| 
									
										
										
										
											2023-11-05 19:07:02 -06:00
										 |  |  |       ready.value = true; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-08-15 23:55:51 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |     useSeoMeta({ | 
					
						
							| 
									
										
										
										
											2022-08-15 23:55:51 +02:00
										 |  |  |       title: | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  | 				props.error.statusCode === 404 | 
					
						
							|  |  |  | 				  ? (i18n.t("page.404-not-found") as string) | 
					
						
							|  |  |  | 				  : (i18n.t("page.an-error-occurred") as string), | 
					
						
							| 
									
										
										
										
											2022-08-15 23:55:51 +02:00
										 |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  |     const buttons = [ | 
					
						
							|  |  |  |       { icon: $globals.icons.home, to: "/", text: i18n.t("general.home") }, | 
					
						
							|  |  |  |     ]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-31 14:00:28 -08:00
										 |  |  |     return { | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  |       buttons, | 
					
						
							| 
									
										
										
										
											2023-11-05 19:07:02 -06:00
										 |  |  |       ready, | 
					
						
							| 
									
										
										
										
											2022-08-15 23:55:51 +02:00
										 |  |  |     }; | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  |   }, | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2021-07-31 14:00:28 -08:00
										 |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <style scoped> | 
					
						
							|  |  |  | h1 { | 
					
						
							|  |  |  |   font-size: 20px; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-23 12:24:38 -08:00
										 |  |  | p { | 
					
						
							|  |  |  |   padding-bottom: 0 !important; | 
					
						
							|  |  |  |   margin-bottom: 0 !important; | 
					
						
							|  |  |  |   font-size: 200px; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2021-07-31 14:00:28 -08:00
										 |  |  | </style> |