mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-11-04 03:03:18 -05:00 
			
		
		
		
	
		
			
	
	
		
			23 lines
		
	
	
		
			508 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
		
		
			
		
	
	
			23 lines
		
	
	
		
			508 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| 
								 | 
							
								import { computed, ref, useContext } from "@nuxtjs/composition-api";
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								export function usePasswordField() {
							 | 
						||
| 
								 | 
							
								  const show = ref(false);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  const { $globals } = useContext();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  const passwordIcon = computed(() => {
							 | 
						||
| 
								 | 
							
								    return show.value ? $globals.icons.eyeOff : $globals.icons.eye;
							 | 
						||
| 
								 | 
							
								  });
							 | 
						||
| 
								 | 
							
								  const inputType = computed(() => (show.value ? "text" : "password"));
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  const togglePasswordShow = () => {
							 | 
						||
| 
								 | 
							
								    show.value = !show.value;
							 | 
						||
| 
								 | 
							
								  };
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  return {
							 | 
						||
| 
								 | 
							
								    inputType,
							 | 
						||
| 
								 | 
							
								    togglePasswordShow,
							 | 
						||
| 
								 | 
							
								    passwordIcon,
							 | 
						||
| 
								 | 
							
								  };
							 | 
						||
| 
								 | 
							
								}
							 |