diff --git a/components/password-prompt.js b/components/password-prompt.js index 8e8e86a..55236ba 100644 --- a/components/password-prompt.js +++ b/components/password-prompt.js @@ -36,9 +36,9 @@ const PasswordPrompt = ({ enableShowApp }) => { } useEffect(() => { - nodejs.channel.addListener('check-pw', passHashToDb, this) + const listener = nodejs.channel.addListener('check-pw', passHashToDb, this) - return () => nodejs.channel.remove('check-pw', passHashToDb) + return () => listener.remove() }, []) const onDeleteDataConfirmation = async () => { diff --git a/components/settings/common/confirm-with-password.js b/components/settings/common/confirm-with-password.js index 4fceacb..ee3bb81 100644 --- a/components/settings/common/confirm-with-password.js +++ b/components/settings/common/confirm-with-password.js @@ -24,10 +24,12 @@ const ConfirmWithPassword = ({ onSuccess, onCancel }) => { } useEffect(() => { - nodejs.channel.addListener('password-check', checkPassword, this) - return () => { - nodejs.channel.removeListener('password-check', checkPassword) - } + const listener = nodejs.channel.addListener( + 'password-check', + checkPassword, + this + ) + return () => listener.remove() }, []) const onIncorrectPassword = () => {