import React, { Component } from 'react' import {graphql, compose} from 'react-apollo' import {updateReferrerMutation} from '../queries/queries' // components import UserSearch from './UserSearch' import UserProfile from './UserProfile' // Material-ui import { withStyles } from '@material-ui/core/styles' import Paper from '@material-ui/core/Paper' import Typography from '@material-ui/core/Typography' const styles = theme => ({ root: { width: '50%', flexGrow: 1, padding: 10, marginLeft: '25%', marginTop: '2%' }, typography: { width: '80%', marginLeft: '10%', marginTop: 40, marginBottom: 40 }, button: { margin: theme.spacing.unit, marginTop: theme.spacing.unit * 3 }, inputField: { width: '80%', marginLeft: '10%', marginTop: 25 } }) class YourReferrer extends Component { constructor (props) { super(props) this.defaultValuesSet = false this.state = { id: '', referrerId: '', firstNameError: false, middleNameError: false, lastNameError: false, aliasError: false } } userSelected (referrerUser) { this.setState({referrerId: referrerUser.id}) this.props.updateReferrerMutation({ variables: { referrerId: referrerUser.id } }) /* Before we are done, we need to update the state of the local storage. */ let user = JSON.parse(localStorage.getItem('loggedInUser')) user.referrerId = referrerUser.id localStorage.setItem('loggedInUser', JSON.stringify(user)) } renderMode () { const { classes } = this.props if (this.state.referrerId !== null) { return (