Skip to content

Commit 3790681

Browse files
author
sw-yx
committed
add full_name and image
1 parent 510ce7c commit 3790681

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

.size-snapshot.json

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
{
22
"/Users/swyx/Netlify/react-netlify-identity-widget/dist/reactNetlifyIdentityWidget.cjs.development.js": {
3-
"bundled": 11694,
4-
"minified": 7556,
5-
"gzipped": 1906
3+
"bundled": 11959,
4+
"minified": 7561,
5+
"gzipped": 1911
66
},
77
"/Users/swyx/Netlify/react-netlify-identity-widget/dist/reactNetlifyIdentityWidget.cjs.production.js": {
8-
"bundled": 11694,
9-
"minified": 7556,
10-
"gzipped": 1906
8+
"bundled": 11959,
9+
"minified": 7561,
10+
"gzipped": 1911
1111
},
1212
"/Users/swyx/Netlify/react-netlify-identity-widget/dist/reactNetlifyIdentityWidget.umd.development.js": {
13-
"bundled": 12617,
14-
"minified": 6616,
15-
"gzipped": 1873
13+
"bundled": 12896,
14+
"minified": 6621,
15+
"gzipped": 1878
1616
},
1717
"/Users/swyx/Netlify/react-netlify-identity-widget/dist/reactNetlifyIdentityWidget.umd.production.js": {
18-
"bundled": 12617,
19-
"minified": 6616,
20-
"gzipped": 1873
18+
"bundled": 12896,
19+
"minified": 6621,
20+
"gzipped": 1878
2121
},
2222
"/Users/swyx/Netlify/react-netlify-identity-widget/dist/reactNetlifyIdentityWidget.es.production.js": {
23-
"bundled": 11459,
24-
"minified": 7367,
25-
"gzipped": 1855,
23+
"bundled": 11724,
24+
"minified": 7372,
25+
"gzipped": 1860,
2626
"treeshaked": {
2727
"rollup": {
2828
"code": 524,

example/src/App.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ function App() {
77
const [dialog, setDialog] = React.useState(false)
88
const identity = useNetlifyIdentity("https://react-netlify-identity-widget.netlify.com")
99
const name =
10-
(identity && identity.user && identity.user.user_metadata && identity.user.user_metadata.name) || "NoName"
10+
(identity && identity.user && identity.user.user_metadata && identity.user.user_metadata.full_name) || "NoName"
11+
const avatar_url = identity && identity.user && identity.user.user_metadata && identity.user.user_metadata.avatar_url
1112
return (
1213
<IdentityContextProvider value={identity}>
1314
<div className="App">
1415
{identity && identity.isLoggedIn ? (
1516
<header className="App-header">
1617
<h1> hello {name}!</h1>
18+
{avatar_url && <img src={avatar_url} style={{ height: 100, borderRadius: "50%" }} />}
1719
<button className="btn" style={{ maxWidth: 400, background: "orangered" }} onClick={() => setDialog(true)}>
1820
LOG OUT
1921
</button>

src/components/signup.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ export function Signup() {
1010
const [isLoading, load] = useLoading()
1111
const signup = () => {
1212
if (!formRef.current) return
13-
const name = formRef.current.username.value
13+
const full_name = formRef.current.username.value
1414
const email = formRef.current.email.value
1515
const password = formRef.current.password.value
16-
const data = { signupSource: "react-netlify-identity-widget", name }
16+
const data = { signupSource: "react-netlify-identity-widget", full_name }
1717
load(signupUser(email, password, data))
1818
.then(user => {
1919
console.log("Success! Signed up", user)

0 commit comments

Comments
 (0)