diff --git a/client/components/Editor.js b/client/components/Editor.js index cc2ca65..05f8afe 100644 --- a/client/components/Editor.js +++ b/client/components/Editor.js @@ -20,8 +20,14 @@ export class Editor extends React.Component { } componentDidMount() { - console.log(this.props.match.params.name) - this.doc = connection.get('demo', this.props.match.params.name) + //console.log(this.props) + + this.doc = connection.get( + this.props.match.params.user, + this.props.match.params.name + ) + console.log(this.doc.collection) + console.log(this.doc.id) this.doc.subscribe(err => { if (err) throw err diff --git a/client/components/Form.js b/client/components/Form.js new file mode 100644 index 0000000..0ac475e --- /dev/null +++ b/client/components/Form.js @@ -0,0 +1,36 @@ +import React from 'react' +import connection from '../connect' +import {withRouter} from 'react-router-dom' + +export class Form extends React.Component { + constructor(props) { + super(props) + + this.goto = this.goto.bind(this) + } + + componentDidMount() { + //stuff + } + goto(event) { + console.log(this.props.history) + //console.log(process.env.NODE_ENV) + //hardcoded link later do this better with routes and stuff :) + //so that we have one user friendly link + if (process.env.NODE_ENV === 'development') { + this.props.history.push('/doc1') + } else { + this.props.history.push( + 'https://code-share-code.herokuapp.com/document/doc1' + ) + } + } + + render() { + let main = + + return main + } +} + +export default withRouter(Form) diff --git a/client/components/index.js b/client/components/index.js index 8ee2f23..ffb2de9 100644 --- a/client/components/index.js +++ b/client/components/index.js @@ -8,3 +8,4 @@ export {default as UserHome} from './user-home' export {Login, Signup} from './auth-form' export {Editor} from './Editor' +export {Form} from './Form' diff --git a/client/components/user-home.js b/client/components/user-home.js index 0a8ee7f..d8fe405 100644 --- a/client/components/user-home.js +++ b/client/components/user-home.js @@ -3,18 +3,22 @@ import PropTypes from 'prop-types' import {connect} from 'react-redux' import {Editor} from './Editor' +import {Form} from './Form' /** * COMPONENT */ export const UserHome = props => { + console.log(props) const {email} = props + const username = email.slice(0, email.indexOf('@')) return (