Patch profile
This commit is contained in:
parent
a90b1ddb5c
commit
b2ae6adca6
@ -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));
|
||||||
|
Loading…
Reference in New Issue
Block a user