mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-30 22:13:47 +03:00
fixed avatar upload bug
This commit is contained in:
parent
c151559fd7
commit
816a32f8eb
@ -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({
|
||||||
|
Loading…
Reference in New Issue
Block a user