We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fcfbbef commit 753bff9Copy full SHA for 753bff9
example/src/App.js
@@ -40,17 +40,22 @@ function AuthExample() {
40
41
const netlifyAuth = {
42
isAuthenticated: false,
43
- authenticate(cb) {
+ user: null,
44
+ authenticate(callback) {
45
this.isAuthenticated = true;
46
netlifyIdentity.open();
- // setTimeout(cb, 100); // fake async
47
- netlifyIdentity.on('login', cb);
+ netlifyIdentity.on('login', user => {
48
+ this.user = user;
49
+ callback(user);
50
+ });
51
},
- signout(cb) {
52
+ signout(callback) {
53
this.isAuthenticated = false;
- // setTimeout(cb, 100);
54
netlifyIdentity.logout();
- netlifyIdentity.on('logout', cb);
55
+ netlifyIdentity.on('logout', () => {
56
+ this.user = null;
57
+ callback();
58
59
}
60
};
61
0 commit comments