support future api for removing files

This commit is contained in:
f0x 2022-09-12 20:50:38 +02:00
parent d6be0bfa84
commit ca25d4c570

View file

@ -50,6 +50,14 @@ module.exports = function UserProfile() {
}); });
} }
// function removeFile(name) {
// return function(e) {
// e.preventDefault();
// dispatch(user.setProfileVal([name, ""]));
// dispatch(user.setProfileVal([`${name}File`, ""]));
// };
// }
return ( return (
<div className="user-profile"> <div className="user-profile">
<h1>Profile</h1> <h1>Profile</h1>
@ -72,6 +80,7 @@ module.exports = function UserProfile() {
<label htmlFor="header" className="file-input button">Browse</label> <label htmlFor="header" className="file-input button">Browse</label>
<span>{account.headerFile ? account.headerFile.name : "no file selected"}</span> <span>{account.headerFile ? account.headerFile.name : "no file selected"}</span>
</div> </div>
{/* <a onClick={removeFile("header")} href="#">remove</a> */}
<input className="hidden" id="header" type="file" accept="image/*" onChange={onFileChange("header")} /> <input className="hidden" id="header" type="file" accept="image/*" onChange={onFileChange("header")} />
</div> </div>
<div> <div>
@ -80,6 +89,7 @@ module.exports = function UserProfile() {
<label htmlFor="avatar" className="file-input button">Browse</label> <label htmlFor="avatar" className="file-input button">Browse</label>
<span>{account.avatarFile ? account.avatarFile.name : "no file selected"}</span> <span>{account.avatarFile ? account.avatarFile.name : "no file selected"}</span>
</div> </div>
{/* <a onClick={removeFile("avatar")} href="#">remove</a> */}
<input className="hidden" id="avatar" type="file" accept="image/*" onChange={onFileChange("avatar")} /> <input className="hidden" id="avatar" type="file" accept="image/*" onChange={onFileChange("avatar")} />
</div> </div>
</div> </div>