Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (ipfsHash) {
// Failed - unpin it from ipfs.menlo.one
// this.localStorage.rm(ipfsHash)
this.remoteStorage.unpin(ipfsHash)
}
let msg = e.message
let timeout = 4000
if (e.message === "Error: MetaMask Tx Signature: User denied transaction signature.") {
msg = "You cancelled the MetaMask transaction."
timeout = 1500
}
console.error(e)
toast(msg, {
autoClose: timeout,
toastId: 123
})
throw e
}
}
}
renderAccountStatus() {
// console.log( 'STATUS: ', this.props.acct.model.status )
if (true) {
toast('This dApp is not connected to a Content Node. To launch your own Content Node, please visit menlo.one for more info.', {
className: 'toast-red-bk',
type: toast.TYPE.ERROR,
toastId: ToastType.Account,
autoClose: false
})
return (
<ul>
<li>
<span>Not connected to Content Node. <a title="Launch a Content Node" href="https://www.menlo.one/docs/">Launch a Content Node</a></span>
</li>
</ul>
)
}
if (this.props.acct.model.status === MetamaskStatus.LoggedOut) {
(res) => {
// console.log(res);
// Refresh the parent component
refreshHandle();
toast.info('Config deleted');
}, (err) => {
// console.log(`Error occurred: ${err}`);
renderAccountStatus() {
// console.log( 'STATUS: ', this.props.acct.model.status )
if (true) {
toast('This dApp is not connected to a Content Node. To launch your own Content Node, please visit menlo.one for more info.', {
className: 'toast-red-bk',
type: toast.TYPE.ERROR,
toastId: ToastType.Account,
autoClose: false
})
return (
<ul>
<li>
<span>Not connected to Content Node. <a title="Launch a Content Node" href="https://www.menlo.one/docs/">Launch a Content Node</a></span>
</li>
</ul>
)
}
if (this.props.acct.model.status === MetamaskStatus.LoggedOut) {
toast('You must first sign into Metamask to take part in discussions.', {
toastId: ToastType.Account,
dispatchedToasts--
}
if (options?.onClose) {
options.onClose(props)
}
}
const toastOptions = { ...options, onClose: onToastClose }
switch (type) {
case SUCCESS:
toast.success(renderToast, toastOptions)
break
case WARNING:
toast.warning(renderToast, toastOptions)
break
case INFO:
toast.info(renderToast, toastOptions)
break
default:
toast.error(renderToast, toastOptions)
}
} else if (options?.isNotification) {
// If it is a notification, try to push it to the browser if borwser notifications are enabled
// - Emit a an event to be processed in the BrowserNotificationsContainer
Emitter.emit(
BROWSER_NOTIFICATIONS_EVENT_KEY,
{
message: toastMessage,
title: toastTitle,
},
// TODO : Flash success
toast.success(
"Vous êtes désormais inscrit, vous pouvez vous connecter !"
);
history.replace("/login");
} catch (error) {
const { violations } = error.response.data;
if (violations) {
violations.forEach(violation => {
apiErrors[violation.propertyPath] = violation.message;
});
setErrors(apiErrors);
}
toast.error("Des erreurs dans votre formulaire !");
}
};
.catch((error) => {
if (error) {
toast.error(Messages.LoadFailure);
}
// No reader found
if (files.length === 1) {
this.setState({ file: files[0] });
} else {
this.setState({ file: null });
}
});
}
function login(success) {
// prompt success toast if login was successfull
if (success) {
toast('Login Successfull! Redirecting...', {
position: toast.POSITION.BOTTOM_CENTER,
className: 'toast-success',
progressClassName: 'success-progress-bar',
autoClose: 2000,
toastId: 1
});
}
// propmt error toast if login failes
else {
toast('Invalid e-mail or password. Please try again', {
position: toast.POSITION.BOTTOM_CENTER,
className: 'toast-error',
progressClassName: 'error-progress-bar',
toastId: 2
});
.then(finished => {
// Redirect to login page after logout is success
dispatch(push('/'))
// Notify visitor with toast
toast.info(`You are logged out! See you later`, {
position: 'top-left',
autoClose: 2000,
hideProgressBar: false,
closeOnClick: true,
draggable: false
})
})
.catch(error => {
async function performCopyMoveOperation(params) {
const {srcRemoteName, srcRemotePath, destRemoteName, destRemotePath, Name, IsDir, dropEffect, updateHandler} = params;
if (dropEffect === "move") { /*Default operation without holding alt is copy, named as move in react-dnd*/
// if (component.props.canCopy) {
await performCopyFile(srcRemoteName, srcRemotePath, destRemoteName, destRemotePath, Name, IsDir);
updateHandler();
if (IsDir) {
toast.info(`Directory copying started in background: ${Name}`);
} else {
toast.info(`File copying started in background: ${Name}`);
}
// } else {
// toast.error("This remote does not support copying");
// }
} else {
// if (component.props.canMove) {
await performMoveFile(srcRemoteName, srcRemotePath, destRemoteName, destRemotePath, Name, IsDir);
updateHandler();
if (IsDir) {
toast.info(`Directory moving started in background: ${Name}`);
} else {
toast.info(`Directory moving started in background: ${Name}`);
}