Skip to content

Commit

Permalink
register happy path works!
Browse files Browse the repository at this point in the history
  • Loading branch information
ahdinosaur committed Jun 23, 2017
1 parent 29c12ea commit dcb7e1b
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 13 deletions.
4 changes: 3 additions & 1 deletion agents/components/Register.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ function LocalAuthenticationForm (props) {
/>
<div className={styles.actions}>
<RaisedButton
type='submit'
label='Create new account'
primary={true}
className={styles.registerAction}
Expand All @@ -94,7 +95,7 @@ LocalAuthenticationForm = flow(
)(LocalAuthenticationForm)

function Register (props) {
const { styles } = props
const { styles, actions } = props
return (
<div className={styles.container}>
<p className={styles.intro}>
Expand All @@ -117,6 +118,7 @@ function Register (props) {
</ul>
<LocalAuthenticationForm
styles={styles}
onSubmit={actions.authentication.register}
/>
</div>
)
Expand Down
19 changes: 19 additions & 0 deletions agents/containers/LogOut.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { connect as connectRedux } from 'react-redux'
import { connect as connectFeathers } from 'feathers-action-react'
import { flow } from 'lodash'
import { push } from 'react-router-redux'

import { authentication } from 'dogstack-agents/actions'
const { logOut } = authentication

import LogOut from '../components/LogOut'

export default flow(
connectFeathers({
actions: { authentication: { logOut } }
}),
connectRedux(
null,
{ push }
)
)(SignOut)
17 changes: 17 additions & 0 deletions agents/containers/Register.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { connect as connectRedux } from 'react-redux'
import { connect as connectFeathers } from 'feathers-action-react'
import { flow } from 'lodash'

import { authentication } from 'dogstack-agents/actions'
const { register } = authentication
import { getRegisterProps } from 'dogstack-agents/getters'

import Register from '../components/Register'

export default flow(
connectFeathers({
selector: getRegisterProps,
actions: { authentication: { register } },
query: []
})
)(Register)
15 changes: 14 additions & 1 deletion app/components/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Nav from './nav'

const Container = createComponent(styles.container, 'div')

export default function Layout (props) {
function Layout (props) {
const { routes, navigationRoutes } = props
const pages = mapRoutePages(routes)

Expand All @@ -34,3 +34,16 @@ const mapRoutePages = map(route => {
<Route path={path} key={key} exact={exact} component={Component} />
)
})

// TODO move this to some config for dogstack
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'
import { IntlProvider } from 'react-intl'
export default (props) => {
return (
<MuiThemeProvider>
<IntlProvider locale='en'>
<Layout {...props} />
</IntlProvider>
</MuiThemeProvider>
)
}
8 changes: 4 additions & 4 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ module.exports = {
},
auth: {
secret: 'CHANGE-ME',
service: 'accounts',
entity: 'account',
service: 'credentials',
entity: 'credential',
local: {
service: 'accounts',
entity: 'account'
service: 'credentials',
entity: 'credential'
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"babel-plugin-ramda": "^1.2.0",
"dog-names": "^1.0.2",
"dogstack": "^0.2.2",
"dogstack-agents": "^0.1.2",
"dogstack-agents": "dogstack/dogstack-agents#better-agents",
"feathers-action": "^2.2.0",
"feathers-action-react": "ahdinosaur/feathers-action-react#cancel",
"feathers-errors": "^2.6.2",
Expand Down
11 changes: 6 additions & 5 deletions routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import React from 'react'
// Top Level Containers
import Home from './app/containers/home'

import Register from './agents/containers/Register'

import {
SignIn,
SignOut,
Register
SignOut
} from 'dogstack-agents/components'
import {
UserIsAuthenticated,
Expand Down Expand Up @@ -39,11 +40,11 @@ export default [
}
},
{
name: 'sign-out',
path: '/sign-out',
name: 'log-out',
path: '/log-out',
Component: UserIsAuthenticatedOrHome(SignOut),
navigation: {
title: 'Sign out',
title: 'Log out',
selector: getIsAuthenticated
}
},
Expand Down
5 changes: 4 additions & 1 deletion updater.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { concat, updateStateAt } from 'redux-fp'
import { routerReducer } from 'react-router-redux'
import { reducer as formReducer } from 'redux-form'

import { updater as agents } from 'dogstack-agents'

const router = updateStateAt('router', reducerToUpdater(routerReducer))
const form = updateStateAt('form', reducerToUpdater(formReducer))

export default concat(
agents,
router
router,
form
)

function reducerToUpdater (reducer) {
Expand Down

0 comments on commit dcb7e1b

Please sign in to comment.