Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33241216
D6451.1768570079.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D6451.1768570079.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D6451: [web] Use Redux instead of `React.State` for `primaryIdentityPublicKey` in `SIWE` component
Attached
Detach File
Event Timeline
Log In to Comment