Skip to content

Commit a9c77b2

Browse files
author
sw-yx
committed
fix: working login/logout components
1 parent 5fef0c9 commit a9c77b2

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
99

10-
## [v0.0.2](https://github.com/sw-yx/react-netlify-identity-widget/compare/v0.0.1...v0.0.2) - 2019-04-24
10+
## [v0.0.3](https://github.com/sw-yx/react-netlify-identity-widget/compare/v0.0.1...v0.0.3) - 2019-04-24
1111

1212
### Commits
1313

1414
- fix dist [`4746911`](https://github.com/sw-yx/react-netlify-identity-widget/commit/474691107f143205dbf89085a26053dce190e585)
1515
- fix: fix it [`8a2ffbd`](https://github.com/sw-yx/react-netlify-identity-widget/commit/8a2ffbda8cbadcbefa34118dbac67e86685d842b)
1616
- fix(filename): just adding husky [`1d748c3`](https://github.com/sw-yx/react-netlify-identity-widget/commit/1d748c33c44a300b55b58e6a4490a78691bea33e)
1717

18+
## v0.0.2 - 2019-04-22
19+
1820
## v0.0.1 - 2019-04-22

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-netlify-identity-widget",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"main": "dist/index.js",
55
"umd:main": "dist/reactNetlifyIdentityWidget.umd.production.js",
66
"module": "dist/reactNetlifyIdentityWidget.es.production.js",

src/app.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from "react"
22
import { useNetlifyIdentity } from "react-netlify-identity"
3-
3+
import { Login } from "./login"
4+
import { Logout } from "./logout"
45
// import Modal from "./modal"
56
// import SiteURLForm from "./forms/siteurl"
67
// import LogoutForm from "./forms/logout"
@@ -58,10 +59,10 @@ import { IdentityContext } from "./context"
5859
// }
5960

6061
function LoggedOutScreen() {
61-
return <div>logged out</div>
62+
return <Login />
6263
}
6364
function LoggedInScreen() {
64-
return <div>logged in</div>
65+
return <Logout />
6566
}
6667

6768
function Gate() {

src/logout.tsx

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from "react"
2+
import { IdentityContext } from "./context"
3+
4+
export function Logout() {
5+
const identity = React.useContext(IdentityContext)
6+
if (!identity) throw new Error("bad context")
7+
8+
return <button onClick={identity.logoutUser}>You are signed in. Log Out</button>
9+
}

0 commit comments

Comments
 (0)