--- a/client/src/reducers/authReducer.js Mon Jul 31 23:18:38 2017 +0200
+++ b/client/src/reducers/authReducer.js Tue Aug 01 12:20:14 2017 +0200
@@ -1,8 +1,10 @@
import Immutable from 'immutable';
import * as types from '../constants/actionTypes';
import UserRecord from '../store/userRecord';
+import GroupRecord from '../store/groupRecord';
import asyncRequest from '../constants/asyncRequest';
import uuidV4 from 'uuid/v4';
+import _ from 'lodash';
export const isAuthenticated = (state = false, action) => {
switch (action.type) {
@@ -103,9 +105,20 @@
export const groups = (state = Immutable.List([]), action) => {
switch (action.type) {
case types.GROUP_LOAD_SUCCESS:
- return Immutable.List(action.groups.results);
+ return Immutable.List(
+ action.groups.map((group) => GroupRecord({
+ ...(_.omit(group, 'is_personal')),
+ isPersonal: group['is_personal']
+ }))
+ );
case types.GROUP_CREATE_SUCCESS:
- return state.push(action.group);
+ return state.push(GroupRecord({
+ ...(_.omit(action.group, 'is_personal')),
+ isPersonal: action.group['is_personal']
+ }));
+ case types.AUTH_LOGOUT: {
+ return Immutable.List(); // empty note list on logout
+ }
default:
return state
}