Skip to content

Commit

Permalink
Support User: ESLint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jordwest committed Jan 25, 2016
1 parent 4d2530e commit b81de33
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
12 changes: 7 additions & 5 deletions client/state/support/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import userSettings from 'lib/user-settings';

/**
* Requests a support user token, then dispatches the relevant actions upon response
*
*
* @param {string} supportUser Support username
* @param {string} supportPassword Support password
* @return {thunk} The action thunk
Expand All @@ -31,10 +31,10 @@ export function supportUserFetchToken( supportUser, supportPassword ) {

const user = new User();

const activateSupportUser = ( userData ) =>
const activateSupportUser = () =>
dispatch( supportUserActivated( Object.assign( {}, user.data ) ) );

const tokenErrorCallback = ( error ) =>
const tokenErrorCallback = ( error ) =>
dispatch( supportUserDeactivated( error.message ) );

const changeUserCallback = error => error
Expand All @@ -58,7 +58,8 @@ export function supportUserRestore() {
/**
* Returns an action object to signal that the support user was activated.
*
* @return {Object} Action object
* @param {Object} userData New user's details
* @return {Object} Action object
*/
export function supportUserActivated( userData ) {
userSettings.fetchSettings();
Expand All @@ -72,7 +73,8 @@ export function supportUserActivated( userData ) {
/**
* Returns an action object to signal that the support user was disabled.
*
* @return {Object} Action object
* @param {error} error The error which caused the deactivation, if any
* @return {Object} Action object
*/
export function supportUserDeactivated( error ) {
userSettings.fetchSettings();
Expand Down
13 changes: 5 additions & 8 deletions client/state/support/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ function isSupportUser( state = false, { type } ) {
return state;
}

function userData( state = {}, { type, userData } ) {
switch ( type ) {
function userData( state = {}, action ) {
switch ( action.type ) {
case SUPPORT_USER_ACTIVATED:
return userData;
return action.userData;
case SUPPORT_USER_DEACTIVATED:
return null;
}

return state;
}

Expand All @@ -47,10 +47,7 @@ function errorMessage( state = null, { type, error } ) {
}

/**
* True if currently in transition between normal and support user
* @param {Boolean} state
* @param {object} action
* @return {Boolean}
* @return {Boolean} true if currently in transition between normal and support user
*/
function isTransitioning( state = false, { type } ) {
switch ( type ) {
Expand Down

0 comments on commit b81de33

Please sign in to comment.