From 9384638e2d3319f40325a4c3d75c227cd04e1cc0 Mon Sep 17 00:00:00 2001 From: sktoiva Date: Wed, 8 Nov 2017 11:52:04 +0200 Subject: [PATCH] Camel case current-user --- src/containers/CheckoutPage/CheckoutPage.test.js | 2 +- src/containers/ProfileSettingsPage/ProfileSettingsPage.duck.js | 2 +- src/ducks/user.duck.js | 2 +- src/util/data.js | 2 +- src/util/propTypes.js | 2 +- src/util/test-data.js | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/containers/CheckoutPage/CheckoutPage.test.js b/src/containers/CheckoutPage/CheckoutPage.test.js index 14a80dd3..e353c550 100644 --- a/src/containers/CheckoutPage/CheckoutPage.test.js +++ b/src/containers/CheckoutPage/CheckoutPage.test.js @@ -17,7 +17,7 @@ describe('CheckoutPage', () => { history: { push: noop }, intl: fakeIntl, listing, - currentUser: createCurrentUser('current-user'), + currentUser: createCurrentUser('currentUser'), params: { id: 'listing1', slug: 'listing1' }, sendOrderRequest: noop, fetchSpeculatedTransaction: noop, diff --git a/src/containers/ProfileSettingsPage/ProfileSettingsPage.duck.js b/src/containers/ProfileSettingsPage/ProfileSettingsPage.duck.js index ff8c29c9..1b808cc3 100644 --- a/src/containers/ProfileSettingsPage/ProfileSettingsPage.duck.js +++ b/src/containers/ProfileSettingsPage/ProfileSettingsPage.duck.js @@ -137,7 +137,7 @@ export const updateProfile = actionPayload => { // Include profile image to denormalized user entity const currentUserId = response.data.data.id; const entities = updatedEntities({}, response.data); - const denormalised = denormalisedEntities(entities, 'current-user', [currentUserId]); + const denormalised = denormalisedEntities(entities, 'currentUser', [currentUserId]); const currentUser = denormalised[0]; // Update current user in state.user.currentUser through user.duck.js diff --git a/src/ducks/user.duck.js b/src/ducks/user.duck.js index 2f8ed9e0..aed711cc 100644 --- a/src/ducks/user.duck.js +++ b/src/ducks/user.duck.js @@ -341,7 +341,7 @@ export const fetchCurrentUser = () => (dispatch, getState, sdk) => { // Include profile image to denormalized user entity const currentUserId = response.data.data.id; const entities = updatedEntities({}, response.data); - const denormalised = denormalisedEntities(entities, 'current-user', [currentUserId]); + const denormalised = denormalisedEntities(entities, 'currentUser', [currentUserId]); const currentUser = denormalised[0]; // set current user id to the logger log.setUserId(currentUser.id.uuid); diff --git a/src/util/data.js b/src/util/data.js index 2dbddb37..a29a0be7 100644 --- a/src/util/data.js +++ b/src/util/data.js @@ -157,7 +157,7 @@ export const ensureUser = user => { * @param {Object} current user entity object, which is to be ensured agains null values */ export const ensureCurrentUser = user => { - const empty = { id: null, type: 'current-user', attributes: { profile: {} }, profileImage: {} }; + const empty = { id: null, type: 'currentUser', attributes: { profile: {} }, profileImage: {} }; return { ...empty, ...user }; }; diff --git a/src/util/propTypes.js b/src/util/propTypes.js index e0cbd90a..1935415d 100644 --- a/src/util/propTypes.js +++ b/src/util/propTypes.js @@ -65,7 +65,7 @@ export const place = shape({ // Denormalised user object export const currentUser = shape({ id: uuid.isRequired, - type: value('current-user').isRequired, + type: value('currentUser').isRequired, attributes: shape({ banned: bool.isRequired, email: string.isRequired, diff --git a/src/util/test-data.js b/src/util/test-data.js index 74db4ed3..5c682b38 100644 --- a/src/util/test-data.js +++ b/src/util/test-data.js @@ -32,7 +32,7 @@ export const createUser = id => ({ // Create a user that conforms to the util/propTypes currentUser schema export const createCurrentUser = id => ({ id: new UUID(id), - type: 'current-user', + type: 'currentUser', attributes: { banned: false, email: `${id}@example.com`,