groups: fix sharing contacts with avatars

Fixes #4064.
This commit is contained in:
Matilde Park 2020-12-02 17:09:22 -05:00
parent 000e8c6964
commit 49d66989fd

View File

@ -71,12 +71,15 @@ const emptyContact = {
export function ContactCard(props: ContactCardProps) {
const us = `~${window.ship}`;
const { contact, rootIdentity } = props;
const onSubmit = async (values: Contact, actions: FormikHelpers<Contact>) => {
const onSubmit = async (values: any, actions: FormikHelpers<Contact>) => {
try {
if(!contact) {
const [,,ship] = props.path.split('/');
values.color = uxToHex(values.color);
await props.api.contacts.share(ship, props.path, us, values)
const sharedValues = Object.assign({}, values);
sharedValues.avatar = (values.avatar === "") ? null : { url: values.avatar };
console.log(values);
await props.api.contacts.share(ship, props.path, us, sharedValues);
actions.setStatus({ success: null });
return;
}