From 9f1b0a7532d23ba0be04e8481f7f69173358f351 Mon Sep 17 00:00:00 2001 From: José Maria Villac Pinheiro Date: Tue, 7 Aug 2018 11:26:18 -0300 Subject: [PATCH] V.0.9.0 - Login and Logout working --- app.js | 13 +++++++------ client/package.json | 22 ++++++++++++---------- client/public/index.html | 1 + client/public/index1.html | 18 ------------------ client/src/App.css | 28 ---------------------------- client/src/App.js | 21 --------------------- client/src/App.test.js | 9 --------- client/src/components/map.js | 31 +++++++++++++++---------------- client/src/index.js | 23 ++++++++++++++++++----- routes/authRoutes.js | 66 +++++++++++++++++++++++++++++++++--------------------------------- 10 files changed, 86 insertions(+), 146 deletions(-) delete mode 100644 client/public/index1.html delete mode 100644 client/src/App.css delete mode 100644 client/src/App.js delete mode 100644 client/src/App.test.js diff --git a/app.js b/app.js index b28a23c..4d2fbaa 100644 --- a/app.js +++ b/app.js @@ -40,18 +40,19 @@ app.set("views", path.join(__dirname, "views")); app.set("view engine", "pug"); // uncomment after placing your favicon in /public -app.use( - cookieSession({ - maxAge: 30 * 24 * 60 * 60 * 1000, // 30 days - keys: [keys.cookieKey] - }) -); app.use(favicon(path.join(__dirname, "public", "favicon.ico"))); app.use(logger("dev")); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false })); app.use(cookieParser()); app.use(express.static(path.join(__dirname, "public"))); +// intersept all incoming requests +app.use( + cookieSession({ + maxAge: 30 * 24 * 60 * 60 * 1000, // 30 days + keys: [keys.cookieKey] + }) +); app.use(passport.initialize()); app.use(passport.session()); diff --git a/client/package.json b/client/package.json index 308c285..f7f25d4 100644 --- a/client/package.json +++ b/client/package.json @@ -6,22 +6,16 @@ "/map": { "target": "http://localhost:5000" }, - "/map/pedro": { + "/map/*": { "target": "http://localhost:5000" }, "/stylesheets": { "target": "http://localhost:5000" }, - "/auth/google": { + "/auth/*": { "target": "http://localhost:5000" }, - "/auth/google/callback": { - "target": "http://localhost:5000" - }, - "/api/current_user": { - "target": "http://localhost:5000" - }, - "/api/logout": { + "/api/*": { "target": "http://localhost:5000" }, "/consumidores": { @@ -32,15 +26,23 @@ } }, "dependencies": { + "@material-ui/core": "^1.4.2", + "@material-ui/icons": "^2.0.0", + "@types/react-redux": "^6.0.6", "ajv": "^6.5.0", - "axios": "0.17.1", + "axios": "^0.17.1", "faker": "^4.1.0", "react": "^16.4.0", "react-dom": "^16.4.0", "react-iframe": "^1.2.0", + "react-redux": "^5.0.7", + "react-router-dom": "^4.3.1", "react-scripts": "1.1.4", "react-select": "1.1.0", + "redux": "^4.0.0", + "redux-thunk": "^2.3.0", "source-map-explorer": "^1.5.0", + "typeface-roboto": "0.0.54", "util": "^0.10.3" }, "scripts": { diff --git a/client/public/index.html b/client/public/index.html index 423331f..96e52c9 100644 --- a/client/public/index.html +++ b/client/public/index.html @@ -7,6 +7,7 @@ + NEXUS diff --git a/client/public/index1.html b/client/public/index1.html deleted file mode 100644 index 67ea32c..0000000 --- a/client/public/index1.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - NEXUS1 - - - -
- - diff --git a/client/src/App.css b/client/src/App.css deleted file mode 100644 index c5c6e8a..0000000 --- a/client/src/App.css +++ /dev/null @@ -1,28 +0,0 @@ -.App { - text-align: center; -} - -.App-logo { - animation: App-logo-spin infinite 20s linear; - height: 80px; -} - -.App-header { - background-color: #222; - height: 150px; - padding: 20px; - color: white; -} - -.App-title { - font-size: 1.5em; -} - -.App-intro { - font-size: large; -} - -@keyframes App-logo-spin { - from { transform: rotate(0deg); } - to { transform: rotate(360deg); } -} diff --git a/client/src/App.js b/client/src/App.js deleted file mode 100644 index 266dc88..0000000 --- a/client/src/App.js +++ /dev/null @@ -1,21 +0,0 @@ -import React, { Component } from "react"; -import "./App.css"; -import FindConsumer from "./components/findConsumer"; -import Map from "./components/map"; - -class App extends Component { - render() { - return ( -
-
- -
-
- -
-
- ); - } -} - -export default App; diff --git a/client/src/App.test.js b/client/src/App.test.js deleted file mode 100644 index a754b20..0000000 --- a/client/src/App.test.js +++ /dev/null @@ -1,9 +0,0 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; -import App from './App'; - -it('renders without crashing', () => { - const div = document.createElement('div'); - ReactDOM.render(, div); - ReactDOM.unmountComponentAtNode(div); -}); diff --git a/client/src/components/map.js b/client/src/components/map.js index d0788a0..0c934fa 100644 --- a/client/src/components/map.js +++ b/client/src/components/map.js @@ -1,18 +1,17 @@ -import React, { Component } from 'react'; -import Iframe from 'react-iframe'; -import 'react-select/dist/react-select.css'; +import React, { Component } from 'react' +import Iframe from 'react-iframe' +import 'react-select/dist/react-select.css' -export default class Map extends Component<*, State> { - constructor(props) { - super(props); - this.state = { - }; - } - render() { - return ( -
-