From 6e4ab9b1e51b9d1c452ba521a7b4124b47546ec2 Mon Sep 17 00:00:00 2001 From: Lewi G Date: Wed, 31 Oct 2018 21:08:01 -0400 Subject: [PATCH] Replaced dropdown with buttons --- .../lib/components/users/UsersAccountMenu.jsx | 59 ++++++++++++------- 1 file changed, 37 insertions(+), 22 deletions(-) diff --git a/packages/example-forum/lib/components/users/UsersAccountMenu.jsx b/packages/example-forum/lib/components/users/UsersAccountMenu.jsx index 8ffcf7198..2cc4c8804 100755 --- a/packages/example-forum/lib/components/users/UsersAccountMenu.jsx +++ b/packages/example-forum/lib/components/users/UsersAccountMenu.jsx @@ -1,25 +1,40 @@ -import { Components, registerComponent } from 'meteor/vulcan:core'; -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import { FormattedMessage } from 'meteor/vulcan:i18n'; -import { STATES } from 'meteor/vulcan:accounts'; +import { registerComponent } from 'meteor/vulcan:core' +import React, { Component } from 'react' +import { withApollo } from 'react-apollo'; +import { Accounts } from 'meteor/accounts-base' -const UsersAccountMenu = ({ state }) => ( - - - - - } - pullRight - menuContents={} - /> -); +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() + }) + + } -UsersAccountMenu.displayName = 'UsersAccountMenu'; + render() { + return ( + <> + + + + ) + } -registerComponent({ name: 'UsersAccountMenu', component: UsersAccountMenu }); +} + +registerComponent({ name: 'UsersAccountMenu', component: withApollo(UsersAccountMenu) })