mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-23 22:12:19 +03:00
improved some error messages
This commit is contained in:
parent
3ca48e3b22
commit
1ab857a21c
@ -199,7 +199,8 @@ export const error = {
|
||||
//Sign-in
|
||||
SIGN_IN: "Your username/password can't be blank",
|
||||
SERVER_SIGN_IN: "Your username/password can't be blank",
|
||||
SIGN_IN_USER_NOT_FOUND: "Sorry, that user doesn't exist!",
|
||||
SIGN_IN_USER_NOT_FOUND:
|
||||
"We're having trouble logging you in right now, please try again later",
|
||||
SERVER_SIGN_IN_USER_NOT_FOUND: "Sorry, that user doesn't exist!",
|
||||
SIGN_IN_AUTH: "Incorrect password",
|
||||
SERVER_SIGN_IN_AUTH: "Incorrect password",
|
||||
|
@ -164,7 +164,7 @@ export default class Slate extends React.Component {
|
||||
deeplink: true,
|
||||
});
|
||||
|
||||
if (!response.data) {
|
||||
if (!response) {
|
||||
dispatchCustomEvent({
|
||||
name: "create-alert",
|
||||
detail: {
|
||||
@ -185,7 +185,7 @@ export default class Slate extends React.Component {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!response.data.slate) {
|
||||
if (!response.data || !response.data.slate) {
|
||||
dispatchCustomEvent({
|
||||
name: "create-alert",
|
||||
detail: {
|
||||
|
@ -133,7 +133,7 @@ export default class SidebarAddFileToBucket extends React.Component {
|
||||
detail: {
|
||||
alert: {
|
||||
message:
|
||||
"Something went wrong while saving your new file. Please refresh your browser.",
|
||||
"We're having trouble connecting right now. Please try again later",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -183,6 +183,15 @@ export default class SceneEditAccount extends React.Component {
|
||||
|
||||
const response = await this.props.onDeleteYourself();
|
||||
if (!response) {
|
||||
dispatchCustomEvent({
|
||||
name: "create-alert",
|
||||
detail: {
|
||||
alert: {
|
||||
message:
|
||||
"We're having trouble connecting right now. Please try again later",
|
||||
},
|
||||
},
|
||||
});
|
||||
this.setState({ deleting: false });
|
||||
}
|
||||
};
|
||||
|
@ -131,7 +131,29 @@ export default class SceneSlate extends React.Component {
|
||||
id: this.props.current.id,
|
||||
});
|
||||
|
||||
if (!response || response.error) {
|
||||
if (!response) {
|
||||
dispatchCustomEvent({
|
||||
name: "create-alert",
|
||||
detail: {
|
||||
alert: {
|
||||
message:
|
||||
"We're having trouble connecting right now. Please try again later",
|
||||
},
|
||||
},
|
||||
});
|
||||
this._remoteLock = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (response.error) {
|
||||
dispatchCustomEvent({
|
||||
name: "create-alert",
|
||||
detail: {
|
||||
alert: {
|
||||
decorator: response.error,
|
||||
},
|
||||
},
|
||||
});
|
||||
this._remoteLock = false;
|
||||
return;
|
||||
}
|
||||
@ -251,14 +273,14 @@ export default class SceneSlate extends React.Component {
|
||||
const url = each.url.replace("https://undefined", "https://");
|
||||
|
||||
// NOTE(andrew)
|
||||
const cid = url.includes('/ipfs/') ?
|
||||
// pull cid from a path format gateway
|
||||
url.split('/ipfs/')[1] :
|
||||
// pull cid from a subdomain format gateway
|
||||
url.match(
|
||||
// regex here performs https://{cid}.ipfs.slate.textile.io => [https://{cid}, {cid}]
|
||||
/(?:http[s]*\:\/\/)*(.*?)\.(?=[^\/]*\..{2,5})/i
|
||||
)[1];
|
||||
const cid = url.includes("/ipfs/")
|
||||
? // pull cid from a path format gateway
|
||||
url.split("/ipfs/")[1]
|
||||
: // pull cid from a subdomain format gateway
|
||||
url.match(
|
||||
// regex here performs https://{cid}.ipfs.slate.textile.io => [https://{cid}, {cid}]
|
||||
/(?:http[s]*\:\/\/)*(.*?)\.(?=[^\/]*\..{2,5})/i
|
||||
)[1];
|
||||
const data = { ...each, cid, url };
|
||||
|
||||
return {
|
||||
@ -384,13 +406,25 @@ export default class SceneSlate extends React.Component {
|
||||
deeplink: true,
|
||||
});
|
||||
|
||||
if (!response || !response.data) {
|
||||
System.dispatchCustomEvent({
|
||||
if (!response) {
|
||||
dispatchCustomEvent({
|
||||
name: "create-alert",
|
||||
detail: {
|
||||
alert: {
|
||||
message:
|
||||
"We're having trouble finding that slate right now. Please try again later",
|
||||
"We're having trouble connecting right now. Please try again later",
|
||||
},
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!response.data) {
|
||||
System.dispatchCustomEvent({
|
||||
name: "create-alert",
|
||||
detail: {
|
||||
alert: {
|
||||
message: "We're having trouble locating that slate",
|
||||
},
|
||||
},
|
||||
});
|
||||
@ -409,8 +443,7 @@ export default class SceneSlate extends React.Component {
|
||||
name: "create-alert",
|
||||
detail: {
|
||||
alert: {
|
||||
message:
|
||||
"We're having trouble finding that slate right now. Please try again later",
|
||||
message: "We're having trouble locating that slate",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user