Skip to content
This repository has been archived by the owner on Apr 16, 2021. It is now read-only.

Commit

Permalink
Hooked up getAdminData call after loginSuccess
Browse files Browse the repository at this point in the history
  • Loading branch information
colbycheeze committed Sep 9, 2016
1 parent 21fe1f6 commit 27a28ab
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/modules/demos.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { call, take, put, select } from 'redux-saga/effects';
import api from 'services';
import { getAdminData } from 'routes/Dashboard/modules/Dashboard';

// ------------------------------------
// Constants
Expand Down Expand Up @@ -131,6 +132,7 @@ export function *watchLogin() {
try {
const token = yield call(api.login, userid, demoState.guid);
yield put(loginSuccess({ token, userid }));
yield put(getAdminData(demoState.guid));
}
catch (error) {
console.log('Login Failure: ', error);
Expand Down
2 changes: 2 additions & 0 deletions src/modules/demos.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { reducerTest, actionTest } from 'redux-ava';
import { call, take, select, put } from 'redux-saga/effects';
import api from 'services';
import mockApi from 'services/mockApi';
import { getAdminData } from 'routes/Dashboard/modules/Dashboard';
import {
GET_DEMO_SESSION,
GET_DEMO_SUCCESS,
Expand Down Expand Up @@ -212,6 +213,7 @@ test('(Saga) watchLogin - Not logged in, API Success', t => {
t.deepEqual(saga.next(demoState).value, call(api.login, action.userid, demoState.guid));

t.deepEqual(saga.next(token).value, put(loginSuccess({ token, userid: action.userid })));
t.deepEqual(saga.next().value, put(getAdminData(demoState.guid)));

// Saga loops back to beginning
t.deepEqual(saga.next().value, take(LOGIN));
Expand Down
3 changes: 2 additions & 1 deletion src/routes/CreateDemo/components/CreateDemo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export class CreateDemo extends React.Component {
}

handleClick = () => {
const body = { name: this.state.demoName };
const body = {};
if (this.state.demoName !== '') body.name = this.state.demoName;
if (this.state.email !== '') body.email = this.state.email;
this.props.createDemo(body);
}
Expand Down
6 changes: 3 additions & 3 deletions src/routes/Dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default (store) => ({
cb(null, Dashboard);
}, 'dashboard');
},
onEnter: (nextState) => {
store.dispatch(getDemoSession(nextState.params.guid));
},
// onEnter: (nextState) => {
// store.dispatch(getDemoSession(nextState.params.guid));
// },
});

0 comments on commit 27a28ab

Please sign in to comment.