Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3753391
D6127.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
D6127.diff
View Options
diff --git a/landing/landing-ssr.react.js b/landing/landing-ssr.react.js
--- a/landing/landing-ssr.react.js
+++ b/landing/landing-ssr.react.js
@@ -4,7 +4,7 @@
import { StaticRouter } from 'react-router';
import Landing from './landing.react';
-import { SIWENonceContext } from './siwe-nonce-context';
+import { SIWEContext } from './siwe-context.js';
export type LandingSSRProps = {
+url: string,
@@ -14,7 +14,7 @@
function LandingSSR(props: LandingSSRProps): React.Node {
const { url, basename, siweNonce } = props;
- const siweNonceContextValue = React.useMemo(
+ const siweContextValue = React.useMemo(
() => ({
siweNonce,
}),
@@ -23,9 +23,9 @@
const routerContext = React.useMemo(() => ({}), []);
return (
<StaticRouter location={url} basename={basename} context={routerContext}>
- <SIWENonceContext.Provider value={siweNonceContextValue}>
+ <SIWEContext.Provider value={siweContextValue}>
<Landing />
- </SIWENonceContext.Provider>
+ </SIWEContext.Provider>
</StaticRouter>
);
}
diff --git a/landing/root.js b/landing/root.js
--- a/landing/root.js
+++ b/landing/root.js
@@ -4,13 +4,13 @@
import { BrowserRouter } from 'react-router-dom';
import Landing from './landing.react';
-import { SIWENonceContext } from './siwe-nonce-context.js';
+import { SIWEContext } from './siwe-context.js';
declare var routerBasename: string;
declare var siweNonce: ?string;
function RootComponent(): React.Node {
- const siweNonceContextValue = React.useMemo(
+ const siweContextValue = React.useMemo(
() => ({
siweNonce,
}),
@@ -18,9 +18,9 @@
);
return (
<BrowserRouter basename={routerBasename}>
- <SIWENonceContext.Provider value={siweNonceContextValue}>
+ <SIWEContext.Provider value={siweContextValue}>
<Landing />
- </SIWENonceContext.Provider>
+ </SIWEContext.Provider>
</BrowserRouter>
);
}
diff --git a/landing/siwe-context.js b/landing/siwe-context.js
new file mode 100644
--- /dev/null
+++ b/landing/siwe-context.js
@@ -0,0 +1,13 @@
+// @flow
+
+import * as React from 'react';
+
+export type SIWEContextType = {
+ +siweNonce: ?string,
+};
+
+const SIWEContext: React.Context<SIWEContextType> = React.createContext({
+ siweNonce: null,
+});
+
+export { SIWEContext };
diff --git a/landing/siwe-nonce-context.js b/landing/siwe-nonce-context.js
deleted file mode 100644
--- a/landing/siwe-nonce-context.js
+++ /dev/null
@@ -1,15 +0,0 @@
-// @flow
-
-import * as React from 'react';
-
-export type SIWENonceContextType = {
- +siweNonce: ?string,
-};
-
-const SIWENonceContext: React.Context<SIWENonceContextType> = React.createContext(
- {
- siweNonce: null,
- },
-);
-
-export { SIWENonceContext };
diff --git a/landing/siwe.react.js b/landing/siwe.react.js
--- a/landing/siwe.react.js
+++ b/landing/siwe.react.js
@@ -27,7 +27,7 @@
import type { SIWEWebViewMessage } from 'lib/types/siwe-types';
import { siweStatement } from 'lib/utils/siwe-utils.js';
-import { SIWENonceContext } from './siwe-nonce-context.js';
+import { SIWEContext } from './siwe-context.js';
import css from './siwe.css';
// details can be found https://0.6.x.wagmi.sh/docs/providers/configuring-chains
@@ -85,7 +85,7 @@
function SIWE(): React.Node {
const { address } = useAccount();
const { data: signer } = useSigner();
- const { siweNonce } = React.useContext(SIWENonceContext);
+ const { siweNonce } = React.useContext(SIWEContext);
const onClick = React.useCallback(() => {
invariant(siweNonce, 'nonce must be present during SIWE attempt');
signInWithEthereum(address, signer, siweNonce);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 11, 2:00 AM (20 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2858269
Default Alt Text
D6127.diff (3 KB)
Attached To
Mode
D6127: [landing] Rename `SIWENonceContext` to `SIWEContext`
Attached
Detach File
Event Timeline
Log In to Comment