'use strict' import React from 'react' import ReactDOM from 'react-dom' import { BrowserRouter as Router, Route, NavLink, Switch, Redirect } from 'react-router-dom' import Progress from './components/Progress' import UriListItem from './containers/UriListItem' import reducer from './reducers' import { fetchData, createNewUrl, setEditing, editUser } from './actions' import UnderlineInput from './components/UnderlineInput' import '../styles/index.scss' class App extends React.Component { constructor () { super() this.state = { error: '', user: { id: '', email: '', password: '', currentPassword: '' }, urls: [], editingUrl: null, working: false } this.dispatch = this.dispatch.bind(this) this.getRegisteredUris = this.getRegisteredUris.bind(this) this.setUserValue = this.setUserValue.bind(this) this.saveUser = this.saveUser.bind(this) } dispatch (action) { if (!action) throw new Error('dispatch: missing action') if (action instanceof Function) { action(this.dispatch, () => this.state) } else { const changes = reducer(this.state, action) if (!changes || !Object.keys(changes).length) return this.setState({ ...changes }) } } componentDidMount () { this.dispatch(fetchData()) } getRegisteredUris () { return this.state.urls.map((item, i) => { return () }) } setUserValue (which, e) { this.setState({ user: { ...this.state.user, [which]: e.target.value } }) } saveUser () { this.dispatch(editUser(this.state.user)) this.setState({ user: { ...this.state.user, email: this.state.user.email, password: '', currentPassword: '' } }) } render () { return (
this.dispatch(setEditing(null))}>
{this.state.error &&
{this.state.error}
} (

Push URIs

Newly published books will be sent to these addresses.

    {this.getRegisteredUris()}
)} /> (

My account

User account settings

this.setUserValue('email', e)} /> this.setUserValue('password', e)} /> this.setUserValue('currentPassword', e)} />
)} /> } />
) } } ReactDOM.render(, document.getElementById('root'))