web-sdk
web-sdk copied to clipboard
OnLogout & onError Portis event handlers not being called
Working with integrating Portis into my company's app. I'm able to pull the account using the implementation below but having issues fully logging out. After calling await portis.logout() it resolves with success: true but it does not trigger the onLogout callback. Instead I get an error (attached below) which also does not get communicated to the onError callback.
Reviewing the network activity, there are still calls being made from the widget after the provider has logged out so I'm unsure if the previous issue has anything to do with it
Code Snippet:
const { Portis } = window;
export async function getPortisAddresses() {
let portis = new Portis(process.env.REACT_APP_PORTIS_ID, 'mainnet');
portis.onLogout(() => {
if (isDev()) {
// eslint-disable-next-line no-console
console.log('logging out');
}
});
portis.onError((error) => {
if (isDev()) {
// eslint-disable-next-line no-console
console.log('error occured', error);
}
});
const accounts = await portis.provider.enable();
// deactivate portis
await portis.logout();
portis = undefined;
return accounts;
}
Error:

Having the same issue