forked from open-webui/open-webui
		
	rf: dom queries in Account component
This commit is contained in:
		
							parent
							
								
									0fc76d46db
								
							
						
					
					
						commit
						a5c1ac9680
					
				
					 1 changed files with 5 additions and 5 deletions
				
			
		|  | @ -15,6 +15,7 @@ | ||||||
| 	let name = ''; | 	let name = ''; | ||||||
| 	let showJWTToken = false; | 	let showJWTToken = false; | ||||||
| 	let JWTTokenCopied = false; | 	let JWTTokenCopied = false; | ||||||
|  | 	let profileImageInputElement: HTMLInputElement; | ||||||
| 
 | 
 | ||||||
| 	const submitHandler = async () => { | 	const submitHandler = async () => { | ||||||
| 		const updatedUser = await updateUserProfile(localStorage.token, name, profileImageUrl).catch( | 		const updatedUser = await updateUserProfile(localStorage.token, name, profileImageUrl).catch( | ||||||
|  | @ -40,11 +41,12 @@ | ||||||
| 	<div class=" space-y-3 pr-1.5 overflow-y-scroll max-h-80"> | 	<div class=" space-y-3 pr-1.5 overflow-y-scroll max-h-80"> | ||||||
| 		<input | 		<input | ||||||
| 			id="profile-image-input" | 			id="profile-image-input" | ||||||
|  | 			bind:this={profileImageInputElement} | ||||||
| 			type="file" | 			type="file" | ||||||
| 			hidden | 			hidden | ||||||
| 			accept="image/*" | 			accept="image/*" | ||||||
| 			on:change={(e) => { | 			on:change={(e) => { | ||||||
| 				const files = e?.target?.files ?? []; | 				const files = profileImageInputElement.files ?? []; | ||||||
| 				let reader = new FileReader(); | 				let reader = new FileReader(); | ||||||
| 				reader.onload = (event) => { | 				reader.onload = (event) => { | ||||||
| 					let originalImageUrl = `${event.target.result}`; | 					let originalImageUrl = `${event.target.result}`; | ||||||
|  | @ -86,7 +88,7 @@ | ||||||
| 						// Display the compressed image | 						// Display the compressed image | ||||||
| 						profileImageUrl = compressedSrc; | 						profileImageUrl = compressedSrc; | ||||||
| 
 | 
 | ||||||
| 						e.target.files = null; | 						profileImageInputElement.files = null; | ||||||
| 					}; | 					}; | ||||||
| 				}; | 				}; | ||||||
| 
 | 
 | ||||||
|  | @ -107,9 +109,7 @@ | ||||||
| 					<button | 					<button | ||||||
| 						class="relative rounded-full dark:bg-gray-700" | 						class="relative rounded-full dark:bg-gray-700" | ||||||
| 						type="button" | 						type="button" | ||||||
| 						on:click={() => { | 						on:click={profileImageInputElement.click} | ||||||
| 							document.getElementById('profile-image-input')?.click(); |  | ||||||
| 						}} |  | ||||||
| 					> | 					> | ||||||
| 						<img | 						<img | ||||||
| 							src={profileImageUrl !== '' ? profileImageUrl : '/user.png'} | 							src={profileImageUrl !== '' ? profileImageUrl : '/user.png'} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Carlos Daniel Vilaseca
						Carlos Daniel Vilaseca