fixed avatar upload bug

This commit is contained in:
Martina 2020-09-23 13:54:43 -07:00
parent c151559fd7
commit 816a32f8eb

View File

@ -71,9 +71,20 @@ export default class SceneEditAccount extends React.Component {
return; return;
} }
const json = await FileUtilities.upload({ file }); const response = await FileUtilities.upload({ file });
if (json.error) { if (!response) {
dispatchCustomEvent({
name: "create-alert",
detail: {
alert: { message: "We're having trouble connecting right now" },
},
});
this.setState({ changingAvatar: false });
return;
}
if (response.error) {
dispatchCustomEvent({ dispatchCustomEvent({
name: "create-alert", name: "create-alert",
detail: { alert: { decorator: json.decorator } }, detail: { alert: { decorator: json.decorator } },
@ -82,6 +93,8 @@ export default class SceneEditAccount extends React.Component {
return; return;
} }
const { json } = response;
const cid = json.data.ipfs.replace("/ipfs/", ""); const cid = json.data.ipfs.replace("/ipfs/", "");
const url = Strings.getCIDGatewayURL(cid); const url = Strings.getCIDGatewayURL(cid);
await Actions.updateViewer({ await Actions.updateViewer({