I'm doing something wrong but I don't figure out what ! I would like to call a function from a class to another, This is how I do
NotificationWeb3.js :
import {useNotification} from "web3uikit";
export default function NotificationWeb3() {
const dispatch = useNotification();
const handleSuccess = async function (tx, type, message, title, icon) {
await handleNotification(tx, type, message, title, icon)
}
const handleNotification = function (type, message, title, icon) {
dispatch({
type:type,
message: message,
title:title,
position:"topR",
icon:icon,
})
}
return handleSuccess();
}
Then I import it in my WorkflowStatus.js :
import { handleSuccess } from "./utils/NotificationWeb3";
<button
onClick={async () =>
await voting({
onSuccess: (value) => {
handleSuccess('info', 'coucou', 'ola', 'bell')
setWorkflowStatus(value)
console.log(value)
},
onError: (err) => {
console.log(err)
}
})
}
>
Change status
</button>
But I've got this error => TypeError: (0 , _utils_NotificationWeb3__WEBPACK_IMPORTED_MODULE_4__.handleSuccess) is not a function
What I'm doing wrong ?