diff --git a/client/boot/index.js b/client/boot/index.js index 47135d65d9deb..3e05dcc483efd 100644 --- a/client/boot/index.js +++ b/client/boot/index.js @@ -154,6 +154,11 @@ function boot() { i18n.setLocaleSlug( user.get().localeSlug ); } ); + // Temporary support for development of the Support User feature + if ( config.isEnabled( 'support-user' ) ) { + require( 'lib/user/dev-support-user' )( user ); + } + translatorJumpstart.init(); reduxStore = createReduxStore(); diff --git a/client/lib/user/dev-support-user.js b/client/lib/user/dev-support-user.js index 4b59735d52d58..3d306b0b13c5e 100644 --- a/client/lib/user/dev-support-user.js +++ b/client/lib/user/dev-support-user.js @@ -2,23 +2,21 @@ * This is a temporary file to assist development of the support user feature. */ -import User from './user'; import config from 'config'; - // TODO: This will be replaced with a UI -if ( config.isEnabled( 'support-user' ) ) { - let user = new User(); +export default function( user ) { + if ( config.isEnabled( 'support-user' ) ) { + const callback = ( error ) => { + if ( error ) { + console.error( error ); + } else { + console.log( 'success' ); + } + }; - const callback = ( error ) => { - if ( error ) { - console.error( error ); - } else { - console.log( 'success' ); - } - }; - - window.supportUser = { - login: ( username, password ) => user.changeUser( username, password, callback ), - logout: () => user.restoreUser() - }; + window.supportUser = { + login: ( username, password ) => user.changeUser( username, password, callback ), + logout: () => user.restoreUser() + }; + } } diff --git a/client/lib/user/user.js b/client/lib/user/user.js index c0602de4a01fb..a865818687baa 100644 --- a/client/lib/user/user.js +++ b/client/lib/user/user.js @@ -255,11 +255,9 @@ User.prototype.restoreUser = function() { this.fetch(); } -} +}; /** * Expose `User` */ module.exports = User; - -require( './dev-support-user' );