mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-30 17:53:31 -04:00 
			
		
		
		
	fix: refresh tag store when new tags are imported (#2504)
This commit is contained in:
		| @@ -74,6 +74,7 @@ import { | |||||||
| } from "@nuxtjs/composition-api"; | } from "@nuxtjs/composition-api"; | ||||||
| import { AxiosResponse } from "axios"; | import { AxiosResponse } from "axios"; | ||||||
| import { useUserApi } from "~/composables/api"; | import { useUserApi } from "~/composables/api"; | ||||||
|  | import { useTagStore } from "~/composables/store/use-tag-store"; | ||||||
| import { validators } from "~/composables/use-validators"; | import { validators } from "~/composables/use-validators"; | ||||||
| import { VForm } from "~/types/vuetify"; | import { VForm } from "~/types/vuetify"; | ||||||
|  |  | ||||||
| @@ -87,13 +88,17 @@ export default defineComponent({ | |||||||
|     const api = useUserApi(); |     const api = useUserApi(); | ||||||
|     const route = useRoute(); |     const route = useRoute(); | ||||||
|     const router = useRouter(); |     const router = useRouter(); | ||||||
|  |     const tags = useTagStore(); | ||||||
|  |  | ||||||
|     function handleResponse(response: AxiosResponse<string> | null, edit = false) { |     function handleResponse(response: AxiosResponse<string> | null, edit = false, refreshTags = false) { | ||||||
|       if (response?.status !== 201) { |       if (response?.status !== 201) { | ||||||
|         state.error = true; |         state.error = true; | ||||||
|         state.loading = false; |         state.loading = false; | ||||||
|         return; |         return; | ||||||
|       } |       } | ||||||
|  |       if (refreshTags) { | ||||||
|  |         tags.actions.refresh(); | ||||||
|  |       } | ||||||
|       router.push(`/recipe/${response.data}?edit=${edit.toString()}`); |       router.push(`/recipe/${response.data}?edit=${edit.toString()}`); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -150,7 +155,7 @@ export default defineComponent({ | |||||||
|       } |       } | ||||||
|       state.loading = true; |       state.loading = true; | ||||||
|       const { response } = await api.recipes.createOneByUrl(url, importKeywordsAsTags); |       const { response } = await api.recipes.createOneByUrl(url, importKeywordsAsTags); | ||||||
|       handleResponse(response, stayInEditMode); |       handleResponse(response, stayInEditMode, importKeywordsAsTags); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     return { |     return { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user