-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathUsersAccountMenu.jsx
More file actions
executable file
·40 lines (33 loc) · 978 Bytes
/
UsersAccountMenu.jsx
File metadata and controls
executable file
·40 lines (33 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { registerComponent } from 'meteor/vulcan:core'
import React, { Component } from 'react'
import { withApollo } from 'react-apollo';
import { Accounts } from 'meteor/accounts-base'
class UsersAccountMenu extends Component {
login = () => {
Meteor.loginWithGithub(null, error => {
if (error) {
// eslint-disable-next-line no-console
console.log(error)
if (error instanceof Accounts.LoginCancelledError) {
// do nothing
} else {
const errorId = `accounts.error_${error.reason
.toLowerCase()
.replace(/ /g, '_')}`
alert(errorId)
}
return
}
this.props.client.resetStore()
})
}
render() {
return (
<>
<button onClick={this.login}>Sign in</button>
<button onClick={this.login}>Sign up</button>
</>
)
}
}
registerComponent({ name: 'UsersAccountMenu', component: withApollo(UsersAccountMenu) })