--- a/client/src/reducers/authReducer.js Tue Jun 20 19:05:01 2017 +0200
+++ b/client/src/reducers/authReducer.js Tue Jun 20 21:56:42 2017 +0200
@@ -1,5 +1,6 @@
import Immutable from 'immutable';
import * as types from '../constants/actionTypes';
+import UserRecord from '../store/userRecord';
export const isAuthenticated = (state = false, action) => {
switch (action.type) {
@@ -17,7 +18,7 @@
case types.AUTH_LOGOUT:
return null;
case types.AUTH_LOGIN_SUCCESS:
- return Immutable.Map(action.user);
+ return new UserRecord(action.user);
case types.USER_UPDATE_SETTINGS:
return state.merge({
first_name: action.firstname,
--- a/client/src/store/configureStore.js Tue Jun 20 19:05:01 2017 +0200
+++ b/client/src/store/configureStore.js Tue Jun 20 21:56:42 2017 +0200
@@ -7,9 +7,10 @@
import { offline } from 'redux-offline';
import offlineDefaultConfig from 'redux-offline/lib/defaults';
import localForage from 'localforage';
-import immutableTransform from 'redux-persist-transform-immutable'
-import NoteRecord from './noteRecord'
-import SessionRecord from './sessionRecord'
+import immutableTransform from 'redux-persist-transform-immutable';
+import NoteRecord from './noteRecord';
+import SessionRecord from './sessionRecord';
+import UserRecord from './userRecord';
import APIClient from '../api/APIClient';
import createEffect from '../api';
import config from '../config';
@@ -35,7 +36,7 @@
};
const immutableTransformConfig = {
- records: [NoteRecord, SessionRecord],
+ records: [NoteRecord, SessionRecord, UserRecord],
whitelist: ['sessions', 'notes', 'currentUser']
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/client/src/store/userRecord.js Tue Jun 20 21:56:42 2017 +0200
@@ -0,0 +1,11 @@
+import Immutable from 'immutable';
+
+export default Immutable.Record({
+ pk: '',
+ username: '',
+
+ email: '',
+ first_name: '',
+ last_name: ''
+
+}, 'User');