diff --git a/client/package-lock.json b/client/package-lock.json
index 2634d62..82ea81f 100644
--- a/client/package-lock.json
+++ b/client/package-lock.json
@@ -2657,7 +2657,8 @@
},
"ansi-regex": {
"version": "2.1.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"aproba": {
"version": "1.2.0",
@@ -2675,11 +2676,13 @@
},
"balanced-match": {
"version": "1.0.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
+ "optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -2692,15 +2695,18 @@
},
"code-point-at": {
"version": "1.1.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"concat-map": {
"version": "0.0.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"console-control-strings": {
"version": "1.1.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"core-util-is": {
"version": "1.0.2",
@@ -2803,7 +2809,8 @@
},
"inherits": {
"version": "2.0.3",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"ini": {
"version": "1.3.5",
@@ -2813,6 +2820,7 @@
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
+ "optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -2825,17 +2833,20 @@
"minimatch": {
"version": "3.0.4",
"bundled": true,
+ "optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
+ "optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@@ -2852,6 +2863,7 @@
"mkdirp": {
"version": "0.5.1",
"bundled": true,
+ "optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -2924,7 +2936,8 @@
},
"number-is-nan": {
"version": "1.0.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"object-assign": {
"version": "4.1.1",
@@ -2934,6 +2947,7 @@
"once": {
"version": "1.4.0",
"bundled": true,
+ "optional": true,
"requires": {
"wrappy": "1"
}
@@ -3009,7 +3023,8 @@
},
"safe-buffer": {
"version": "5.1.2",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"safer-buffer": {
"version": "2.1.2",
@@ -3039,6 +3054,7 @@
"string-width": {
"version": "1.0.2",
"bundled": true,
+ "optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@@ -3056,6 +3072,7 @@
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
+ "optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@@ -3094,11 +3111,13 @@
},
"wrappy": {
"version": "1.0.2",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"yallist": {
"version": "3.0.3",
- "bundled": true
+ "bundled": true,
+ "optional": true
}
}
},
@@ -5720,7 +5739,8 @@
},
"ansi-regex": {
"version": "2.1.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"aproba": {
"version": "1.2.0",
@@ -5738,11 +5758,13 @@
},
"balanced-match": {
"version": "1.0.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
+ "optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -5755,15 +5777,18 @@
},
"code-point-at": {
"version": "1.1.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"concat-map": {
"version": "0.0.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"console-control-strings": {
"version": "1.1.0",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"core-util-is": {
"version": "1.0.2",
@@ -5866,7 +5891,8 @@
},
"inherits": {
"version": "2.0.3",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"ini": {
"version": "1.3.5",
@@ -5876,6 +5902,7 @@
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
+ "optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -5888,17 +5915,20 @@
"minimatch": {
"version": "3.0.4",
"bundled": true,
+ "optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"minipass": {
"version": "2.2.4",
"bundled": true,
+ "optional": true,
"requires": {
"safe-buffer": "^5.1.1",
"yallist": "^3.0.0"
@@ -5915,6 +5945,7 @@
"mkdirp": {
"version": "0.5.1",
"bundled": true,
+ "optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -5987,7 +6018,8 @@
},
"number-is-nan": {
"version": "1.0.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"object-assign": {
"version": "4.1.1",
@@ -5997,6 +6029,7 @@
"once": {
"version": "1.4.0",
"bundled": true,
+ "optional": true,
"requires": {
"wrappy": "1"
}
@@ -6072,7 +6105,8 @@
},
"safe-buffer": {
"version": "5.1.1",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"safer-buffer": {
"version": "2.1.2",
@@ -6102,6 +6136,7 @@
"string-width": {
"version": "1.0.2",
"bundled": true,
+ "optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@@ -6119,6 +6154,7 @@
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
+ "optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@@ -6157,11 +6193,13 @@
},
"wrappy": {
"version": "1.0.2",
- "bundled": true
+ "bundled": true,
+ "optional": true
},
"yallist": {
"version": "3.0.2",
- "bundled": true
+ "bundled": true,
+ "optional": true
}
}
},
diff --git a/client/public/favicon.ico b/client/public/favicon.ico
old mode 100644
new mode 100755
index a11777c..2a87841
Binary files a/client/public/favicon.ico and b/client/public/favicon.ico differ
diff --git a/client/public/index.html b/client/public/index.html
index 476d00b..c7036ba 100644
--- a/client/public/index.html
+++ b/client/public/index.html
@@ -32,7 +32,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
-
React App
+ PlexRex
diff --git a/client/src/actions/index.js b/client/src/actions/index.js
index 8b35777..d06cda0 100644
--- a/client/src/actions/index.js
+++ b/client/src/actions/index.js
@@ -1,8 +1,9 @@
import axios from 'axios';
import {FETCH_USER, FETCH_PLEX_TOKEN} from './types';
+// Action Creators
export const fetchUser = () => async dispatch => {
- const res = await axios.get('/auth/current_user');
+ const res = await axios.get('/api/auth/current_user');
dispatch({type: FETCH_USER, payload: res.data});
};
diff --git a/client/src/components/App.js b/client/src/components/App.js
index 99b792a..2eea422 100644
--- a/client/src/components/App.js
+++ b/client/src/components/App.js
@@ -1,27 +1,19 @@
import React, {Component} from 'react';
import {BrowserRouter, Route} from 'react-router-dom';
+import {connect} from 'react-redux';
import axios from 'axios';
+import * as actions from '../actions';
import Header from './Header';
-import Landing from './Landing';
-import Dashboard from './Dashboard';
+import Hero from './Hero';
+import CreateAccount from './CreateAccount';
import PlexForm from './plex/PlexForm';
-// const Dashboard = () => Dashboard
;
-// const SurveyNew = () => SurveyNew
;
class App extends Component {
- state = {user: {}};
componentDidMount() {
- this.fetchUser();
+ this.props.fetchUser();
}
- fetchUser = async () => {
- const res = await axios.get('/auth/current_user');
- this.setState({user: res.data});
- console.log(res.data);
- return res;
- };
-
render() {
return (
@@ -29,13 +21,10 @@ class App extends Component {
@@ -44,4 +33,7 @@ class App extends Component {
}
}
-export default App;
+export default connect(
+ null,
+ actions,
+)(App);
diff --git a/client/src/components/CreateAccount.css b/client/src/components/CreateAccount.css
new file mode 100644
index 0000000..ff94e8f
--- /dev/null
+++ b/client/src/components/CreateAccount.css
@@ -0,0 +1,7 @@
+.no-bottom-margin {
+ margin-bottom: 0px;
+}
+
+.margin-spacing {
+ margin: 3em 0;
+}
diff --git a/client/src/components/CreateAccount.js b/client/src/components/CreateAccount.js
new file mode 100644
index 0000000..0f86c21
--- /dev/null
+++ b/client/src/components/CreateAccount.js
@@ -0,0 +1,116 @@
+import React from 'react';
+import axios from 'axios';
+import PropTypes from 'prop-types';
+import CssBaseline from '@material-ui/core/CssBaseline';
+import {connect} from 'react-redux';
+import {withStyles} from '@material-ui/core/styles';
+import './CreateAccount.css';
+import Modal from './Modal';
+import styles from './css';
+
+class CreateAccount extends React.Component {
+ state = {email: '', password: '', section_data: ''};
+
+ onFormSubmit = event => {
+ event.preventDefault();
+ this.getPlexToken(this.state);
+ };
+
+ getPlexToken = async params => {
+ const res = await axios.get('/plex/auth', {params});
+ return res;
+ };
+
+ fetchSections = async params => {
+ const res = await axios.get('/plex/library/sections');
+ console.log(res);
+ this.setState({section_data: res.data});
+ };
+
+ render() {
+ const {classes} = this.props;
+ return (
+
+
+
+
+
+
Fetch Plex Token
+
+
+
+
+
+
+
+
+ );
+ }
+}
+
+CreateAccount.propTypes = {
+ classes: PropTypes.object.isRequired,
+};
+
+function mapStateToProps({auth}) {
+ return {auth};
+}
+
+export default connect(mapStateToProps)(withStyles(styles)(CreateAccount));
diff --git a/client/src/components/Dashboard.js b/client/src/components/Dashboard.js
deleted file mode 100644
index 2bf08a5..0000000
--- a/client/src/components/Dashboard.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import React from 'react';
-// import {Link} from 'react-router-dom';
-
-const Dashboard = () => {
- return Dashboard
;
-};
-
-export default Dashboard;
diff --git a/client/src/components/Header.js b/client/src/components/Header.js
index fdfb1a5..055340a 100644
--- a/client/src/components/Header.js
+++ b/client/src/components/Header.js
@@ -4,28 +4,20 @@ import {Link} from 'react-router-dom';
class Header extends Component {
renderContent() {
+ console.log('this.props.auth', this.props.auth);
switch (this.props.auth) {
case null:
return;
case false:
return (
- Login With Google
+ Login With Google
);
default:
- if (!this.props.auth.plexToken) {
- return (
-
-
- live_tvImport Plex
-
-
- );
- }
return (
- Logout
+ Logout
);
}
@@ -35,7 +27,7 @@ class Header extends Component {