import React from 'react';
import { connect } from 'react-redux';
import { withRouter } from 'react-router';

import actions from '../actions';

const Auth = ({ params: { type }, router, establishConnection }) => {
    if (type === 'ESTABLISH_CONNECTION') {
        establishConnection();
        router.replace('/');
    }
    return null;
};

Auth.propTypes = {
    type: React.PropTypes.string,
    uri: React.PropTypes.string,
    secret_key: React.PropTypes.string,
    router: React.PropTypes.object,
    establishConnection: React.PropTypes.func
};

const mapDispatchToProps = (dispatch, { params: { uri, secret_key } }) => ({
    establishConnection: () => dispatch(actions.establishConnection(uri, secret_key))
});


export default withRouter(
    connect(
        undefined,
        mapDispatchToProps
    )(Auth)
);

@@ -143,85 +143,101 @@
 ;%0A%0Ac
-onst
+lass
  Auth 
-= (%7B params: %7B type %7D, router, establishConnection %7D) =%3E %7B%0A    if (
+extends React.Component %7B%0A    componentWillMount() %7B%0A        if (this.props.params.
 type
@@ -271,24 +271,39 @@
 ) %7B%0A        
+    this.props.
 establishCon
@@ -317,24 +317,39 @@
 ();%0A        
+    this.props.
 router.repla
@@ -365,10 +365,18 @@
     
+  
-%7D%0A
+  %7D%0A    
     
@@ -392,30 +392,114 @@
 ll;%0A
-%7D;%0A%0AAuth.propTypes = %7B
+    %7D%0A%0A    render() %7B%0A        return null;%0A    %7D%0A%7D%0A%0AAuth.propTypes = %7B%0A    params: React.PropTypes.object,
 %0A   

Refactor Auth to be ES6 React Component class