Page MenuHomePhorge

D6451.1768570079.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D6451.1768570079.diff

diff --git a/web/account/siwe.react.js b/web/account/siwe.react.js
--- a/web/account/siwe.react.js
+++ b/web/account/siwe.react.js
@@ -13,6 +13,7 @@
import _merge from 'lodash/fp/merge';
import * as React from 'react';
import { FaEthereum } from 'react-icons/fa';
+import { useDispatch } from 'react-redux';
import { useAccount, useSigner } from 'wagmi';
import {
@@ -35,6 +36,7 @@
import Button from '../components/button.react';
import LoadingIndicator from '../loading-indicator.react';
+import { setPrimaryIdentityPublicKey } from '../redux/primary-identity-public-key-reducer';
import { useSelector } from '../redux/redux-utils';
import { webLogInExtraInfoSelector } from '../selectors/account-selectors.js';
import { wagmiChains } from '../utils/wagmi-utils';
@@ -47,6 +49,7 @@
const { openConnectModal } = useConnectModal();
const { address } = useAccount();
const { data: signer } = useSigner();
+ const dispatch = useDispatch();
const dispatchActionPromise = useDispatchActionPromise();
const getSIWENonceCall = useServerCall(getSIWENonce);
const getSIWENonceCallLoadingStatus = useSelector(
@@ -56,10 +59,6 @@
const logInExtraInfo = useSelector(webLogInExtraInfoSelector);
const [siweNonce, setSIWENonce] = React.useState<?string>(null);
- const [
- primaryIdentityPublicKey,
- setPrimaryIdentityPublicKey,
- ] = React.useState<?string>(null);
const [
hasSIWEButtonBeenClicked,
setHasSIWEButtonBeenClicked,
@@ -83,15 +82,21 @@
);
}, [dispatchActionPromise, getSIWENonceCall, siweNonceShouldBeFetched]);
+ const primaryIdentityPublicKey = useSelector(
+ state => state.primaryIdentityPublicKey,
+ );
React.useEffect(() => {
(async () => {
await olm.init();
const account = new olm.Account();
account.create();
const { ed25519 } = JSON.parse(account.identity_keys());
- setPrimaryIdentityPublicKey(ed25519);
+ dispatch({
+ type: setPrimaryIdentityPublicKey,
+ payload: ed25519,
+ });
})();
- }, []);
+ }, [dispatch]);
const siweButtonColor = React.useMemo(
() => ({ backgroundColor: 'white', color: 'black' }),

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 16, 1:27 PM (15 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5944505
Default Alt Text
D6451.1768570079.diff (2 KB)

Event Timeline