mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-31 02:03:35 -04:00 
			
		
		
		
	reorganize all frontend items
This commit is contained in:
		
							
								
								
									
										52
									
								
								frontend/utils/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								frontend/utils/index.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | ||||
| import { recipe } from "@/utils/recipe"; | ||||
| import { store } from "@/store"; | ||||
|  | ||||
| // TODO: Migrate to Mixins | ||||
|  | ||||
| export const utils = { | ||||
|   recipe: recipe, | ||||
|   generateUniqueKey(item, index) { | ||||
|     return `${item}-${index}`; | ||||
|   }, | ||||
|   getDateAsPythonDate(dateObject) { | ||||
|     if (!dateObject) return null; | ||||
|     const month = dateObject.getMonth() + 1; | ||||
|     const day = dateObject.getDate(); | ||||
|     const year = dateObject.getFullYear(); | ||||
|     return `${year}-${month}-${day}`; | ||||
|   }, | ||||
|   notify: { | ||||
|     info: function(text, title = null) { | ||||
|       store.commit("setSnackbar", { | ||||
|         open: true, | ||||
|         title: title, | ||||
|         text: text, | ||||
|         color: "info", | ||||
|       }); | ||||
|     }, | ||||
|     success: function(text, title = null) { | ||||
|       store.commit("setSnackbar", { | ||||
|         open: true, | ||||
|         title: title, | ||||
|         text: text, | ||||
|         color: "success", | ||||
|       }); | ||||
|     }, | ||||
|     error: function(text, title = null) { | ||||
|       store.commit("setSnackbar", { | ||||
|         open: true, | ||||
|         title: title, | ||||
|         text: text, | ||||
|         color: "error", | ||||
|       }); | ||||
|     }, | ||||
|     warning: function(text, title = null) { | ||||
|       store.commit("setSnackbar", { | ||||
|         open: true, | ||||
|         title: title, | ||||
|         text: text, | ||||
|         color: "warning", | ||||
|       }); | ||||
|     }, | ||||
|   }, | ||||
| }; | ||||
		Reference in New Issue
	
	Block a user