Skip to content

Commit dcb7e1b

Browse files
committed
register happy path works!
1 parent 29c12ea commit dcb7e1b

File tree

8 files changed

+68
-13
lines changed

8 files changed

+68
-13
lines changed

agents/components/Register.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ function LocalAuthenticationForm (props) {
7474
/>
7575
<div className={styles.actions}>
7676
<RaisedButton
77+
type='submit'
7778
label='Create new account'
7879
primary={true}
7980
className={styles.registerAction}
@@ -94,7 +95,7 @@ LocalAuthenticationForm = flow(
9495
)(LocalAuthenticationForm)
9596

9697
function Register (props) {
97-
const { styles } = props
98+
const { styles, actions } = props
9899
return (
99100
<div className={styles.container}>
100101
<p className={styles.intro}>
@@ -117,6 +118,7 @@ function Register (props) {
117118
</ul>
118119
<LocalAuthenticationForm
119120
styles={styles}
121+
onSubmit={actions.authentication.register}
120122
/>
121123
</div>
122124
)

agents/containers/LogOut.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { connect as connectRedux } from 'react-redux'
2+
import { connect as connectFeathers } from 'feathers-action-react'
3+
import { flow } from 'lodash'
4+
import { push } from 'react-router-redux'
5+
6+
import { authentication } from 'dogstack-agents/actions'
7+
const { logOut } = authentication
8+
9+
import LogOut from '../components/LogOut'
10+
11+
export default flow(
12+
connectFeathers({
13+
actions: { authentication: { logOut } }
14+
}),
15+
connectRedux(
16+
null,
17+
{ push }
18+
)
19+
)(SignOut)

agents/containers/Register.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { connect as connectRedux } from 'react-redux'
2+
import { connect as connectFeathers } from 'feathers-action-react'
3+
import { flow } from 'lodash'
4+
5+
import { authentication } from 'dogstack-agents/actions'
6+
const { register } = authentication
7+
import { getRegisterProps } from 'dogstack-agents/getters'
8+
9+
import Register from '../components/Register'
10+
11+
export default flow(
12+
connectFeathers({
13+
selector: getRegisterProps,
14+
actions: { authentication: { register } },
15+
query: []
16+
})
17+
)(Register)

app/components/layout.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Nav from './nav'
99

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

12-
export default function Layout (props) {
12+
function Layout (props) {
1313
const { routes, navigationRoutes } = props
1414
const pages = mapRoutePages(routes)
1515

@@ -34,3 +34,16 @@ const mapRoutePages = map(route => {
3434
<Route path={path} key={key} exact={exact} component={Component} />
3535
)
3636
})
37+
38+
// TODO move this to some config for dogstack
39+
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'
40+
import { IntlProvider } from 'react-intl'
41+
export default (props) => {
42+
return (
43+
<MuiThemeProvider>
44+
<IntlProvider locale='en'>
45+
<Layout {...props} />
46+
</IntlProvider>
47+
</MuiThemeProvider>
48+
)
49+
}

config/default.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ module.exports = {
1313
},
1414
auth: {
1515
secret: 'CHANGE-ME',
16-
service: 'accounts',
17-
entity: 'account',
16+
service: 'credentials',
17+
entity: 'credential',
1818
local: {
19-
service: 'accounts',
20-
entity: 'account'
19+
service: 'credentials',
20+
entity: 'credential'
2121
}
2222
}
2323
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"babel-plugin-ramda": "^1.2.0",
5353
"dog-names": "^1.0.2",
5454
"dogstack": "^0.2.2",
55-
"dogstack-agents": "^0.1.2",
55+
"dogstack-agents": "dogstack/dogstack-agents#better-agents",
5656
"feathers-action": "^2.2.0",
5757
"feathers-action-react": "ahdinosaur/feathers-action-react#cancel",
5858
"feathers-errors": "^2.6.2",

routes.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import React from 'react'
44
// Top Level Containers
55
import Home from './app/containers/home'
66

7+
import Register from './agents/containers/Register'
8+
79
import {
810
SignIn,
9-
SignOut,
10-
Register
11+
SignOut
1112
} from 'dogstack-agents/components'
1213
import {
1314
UserIsAuthenticated,
@@ -39,11 +40,11 @@ export default [
3940
}
4041
},
4142
{
42-
name: 'sign-out',
43-
path: '/sign-out',
43+
name: 'log-out',
44+
path: '/log-out',
4445
Component: UserIsAuthenticatedOrHome(SignOut),
4546
navigation: {
46-
title: 'Sign out',
47+
title: 'Log out',
4748
selector: getIsAuthenticated
4849
}
4950
},

updater.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import { concat, updateStateAt } from 'redux-fp'
22
import { routerReducer } from 'react-router-redux'
3+
import { reducer as formReducer } from 'redux-form'
34

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

67
const router = updateStateAt('router', reducerToUpdater(routerReducer))
8+
const form = updateStateAt('form', reducerToUpdater(formReducer))
79

810
export default concat(
911
agents,
10-
router
12+
router,
13+
form
1114
)
1215

1316
function reducerToUpdater (reducer) {

0 commit comments

Comments
 (0)