Patch profile

This commit is contained in:
Kieran 2023-01-03 11:01:36 +00:00
parent a90b1ddb5c
commit b2ae6adca6
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941

View File

@ -77,14 +77,28 @@ export default function ProfilePage() {
}, [showLnQr]); }, [showLnQr]);
async function saveProfile() { async function saveProfile() {
let ev = await publisher.metadata({ // copy user object and delete internal fields
let userCopy = {
...user,
name, name,
about, about,
picture, picture,
website, website,
nip05, nip05,
lud16 lud16
};
delete userCopy["loaded"];
delete userCopy["fromEvent"];
// trim empty string fields
Object.keys(userCopy).forEach(k => {
if(userCopy[k] === "") {
delete userCopy[k];
}
}); });
console.debug(userCopy);
let ev = await publisher.metadata(userCopy);
console.debug(ev); console.debug(ev);
publisher.broadcast(ev); publisher.broadcast(ev);
dispatch(resetProfile(id)); dispatch(resetProfile(id));