# HG changeset patch # User ymh # Date 1497988602 -7200 # Node ID 9206af01f5e55badbfd5991f1ebe62b92727094c # Parent f402435be429a4072289a39509e9075d6da5a896 Change to UserRecord diff -r f402435be429 -r 9206af01f5e5 client/src/reducers/authReducer.js --- 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, diff -r f402435be429 -r 9206af01f5e5 client/src/store/configureStore.js --- 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'] } diff -r f402435be429 -r 9206af01f5e5 client/src/store/userRecord.js --- /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');