Skip to content

Commit 50b2e6a

Browse files
author
swyx
committed
generalize
1 parent bd7ea05 commit 50b2e6a

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

src/App.js

+24-5
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,34 @@ function Logout() {
124124
}
125125

126126
function App() {
127-
const identity = useNetlifyIdentity(
128-
// TODO: CHANGE THIS URL IF YOU ARE USING A DIFFERENT NETLIFY INSTANCE
129-
'https://festive-nightingale-47f180.netlify.com'
130-
// TODO: CHANGE THIS URL IF YOU ARE USING A DIFFERENT NETLIFY INSTANCE
131-
);
127+
// TODO: CHANGE THIS URL IF YOU ARE USING A DIFFERENT NETLIFY INSTANCE
128+
// e.g. 'https://unruffled-roentgen-04c3b8.netlify.com'
129+
const [url, setUrl] = React.useState(window.location.origin);
130+
const handler = e => setUrl(e.target.value);
131+
const identity = useNetlifyIdentity(url);
132132
return (
133133
<IdentityContext.Provider value={identity}>
134134
<div className="App">
135135
<h1>Netlify Identity + Reach Router demo</h1>
136+
<label>
137+
<a href="https://www.netlify.com/docs/identity/">Netlify Identity</a>{' '}
138+
Instance:{' '}
139+
<input
140+
type="text"
141+
placeholder="your instance here e.g. https://unruffled-roentgen-04c3b8.netlify.com"
142+
value={url}
143+
onChange={handler}
144+
size={50}
145+
/>
146+
{window.location.hostname === 'localhost' ? (
147+
<pre>WARNING: this demo doesn't work on localhost</pre>
148+
) : (
149+
<pre>
150+
your instance here e.g.
151+
https://unruffled-roentgen-04c3b8.netlify.com
152+
</pre>
153+
)}
154+
</label>
136155
<Nav />
137156
<Router>
138157
<Home path="/" />

0 commit comments

Comments
 (0)