Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3503574
D6719.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D6719.diff
View Options
diff --git a/web/account/log-in-form.react.js b/web/account/log-in-form.react.js
--- a/web/account/log-in-form.react.js
+++ b/web/account/log-in-form.react.js
@@ -1,7 +1,9 @@
// @flow
+import olm from '@matrix-org/olm';
import { useConnectModal } from '@rainbow-me/rainbowkit';
import * as React from 'react';
+import { useDispatch } from 'react-redux';
import { useSigner } from 'wagmi';
import css from './log-in-form.css';
@@ -9,10 +11,25 @@
import SIWELoginForm from './siwe-login-form.react.js';
import TraditionalLoginForm from './traditional-login-form.react.js';
import OrBreak from '../components/or-break.react.js';
+import { setPrimaryIdentityPublicKey } from '../redux/primary-identity-public-key-reducer.js';
function LoginForm(): React.Node {
const { openConnectModal } = useConnectModal();
const { data: signer } = useSigner();
+ const dispatch = useDispatch();
+
+ React.useEffect(() => {
+ (async () => {
+ await olm.init();
+ const account = new olm.Account();
+ account.create();
+ const { ed25519 } = JSON.parse(account.identity_keys());
+ dispatch({
+ type: setPrimaryIdentityPublicKey,
+ payload: ed25519,
+ });
+ })();
+ }, [dispatch]);
const [
siweAuthFlowSelected,
diff --git a/web/account/siwe-login-form.react.js b/web/account/siwe-login-form.react.js
--- a/web/account/siwe-login-form.react.js
+++ b/web/account/siwe-login-form.react.js
@@ -2,10 +2,8 @@
import '@rainbow-me/rainbowkit/styles.css';
-import olm from '@matrix-org/olm';
import invariant from 'invariant';
import * as React from 'react';
-import { useDispatch } from 'react-redux';
import { useAccount, useSigner } from 'wagmi';
import {
@@ -33,7 +31,6 @@
import Button from '../components/button.react.js';
import OrBreak from '../components/or-break.react.js';
import LoadingIndicator from '../loading-indicator.react.js';
-import { setPrimaryIdentityPublicKey } from '../redux/primary-identity-public-key-reducer.js';
import { useSelector } from '../redux/redux-utils.js';
import { webLogInExtraInfoSelector } from '../selectors/account-selectors.js';
@@ -47,7 +44,6 @@
function SIWELoginForm(props: SIWELoginFormProps): React.Node {
const { address } = useAccount();
const { data: signer } = useSigner();
- const dispatch = useDispatch();
const dispatchActionPromise = useDispatchActionPromise();
const getSIWENonceCall = useServerCall(getSIWENonce);
const getSIWENonceCallLoadingStatus = useSelector(
@@ -77,18 +73,6 @@
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());
- dispatch({
- type: setPrimaryIdentityPublicKey,
- payload: ed25519,
- });
- })();
- }, [dispatch]);
const callSIWEAuthEndpoint = React.useCallback(
(message: string, signature: string, extraInfo) =>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 21, 5:40 AM (18 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2686498
Default Alt Text
D6719.diff (3 KB)
Attached To
Mode
D6719: [web] Move `setPrimaryIdentityPublicKey` up from `SIWELoginForm` to `LoginForm`
Attached
Detach File
Event Timeline
Log In to Comment