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 (
-
-
-
- );
- }
+export default class Map extends Component {
+ constructor (props) {
+ super(props)
+ this.state = {}
+ }
+ render () {
+ return (
+
+
+
+ )
+ }
}
diff --git a/client/src/index.js b/client/src/index.js
index b86fc74..d763584 100644
--- a/client/src/index.js
+++ b/client/src/index.js
@@ -3,11 +3,24 @@
* @author José Maria Villac Pinheiro
* @date 2018-07-19
*/
-import React from "react";
-import ReactDOM from "react-dom";
-import "./index.css";
-import App from "./App";
+import 'typeface-roboto';
+import React from 'react';
+import ReactDOM from 'react-dom';
+import { Provider } from 'react-redux';
+import { createStore, applyMiddleware } from 'redux';
+import reduxThunk from "redux-thunk";
+
+import './index.css';
+import App from './components/App';
// import registerServiceWorker from "./registerServiceWorker";
+import reducers from './reducers';
+
+const store = createStore(reducers, {}, applyMiddleware(reduxThunk));
-ReactDOM.render(, document.getElementById("root"));
+ReactDOM.render(
+
+
+ ,
+ document.getElementById('root')
+);
// registerServiceWorker();
diff --git a/routes/authRoutes.js b/routes/authRoutes.js
index 88fcde0..b3abd89 100644
--- a/routes/authRoutes.js
+++ b/routes/authRoutes.js
@@ -1,42 +1,42 @@
// Autentication routes
//
-const passport = require("passport"); // from npm
+const passport = require('passport') // from npm
module.exports = router => {
- // Enter to authenticate the user
+ // Enter to authenticate the user
router.get(
- "/auth/google",
- passport.authenticate("google", {
- scope: ["profile", "email"]
- })
- );
+ '/auth/google',
+ passport.authenticate('google', {
+ scope: ['profile', 'email']
+ })
+ )
- // Page after authenticate
+ // Page after authenticate
router.get(
- "/auth/google/callback",
- passport.authenticate("google"),
- (err, req, res, next) => {
- // custom error handler to catch any errors, such as TokenError
- if (err.name === "TokenError") {
- res.redirect("http://nexusbr.com"); // redirect them back to the login page
- } else {
- console.log("Falhou ao logar!");
- // Handle other errors here
- }
- },
- (req, res) => {
- console.log("Logou com sucesso!");
- // On success, redirect back to '/'
- res.redirect("/");
- }
- );
+ '/auth/google/callback',
+ passport.authenticate('google'), // middleware to authenticate the user, after authenticate it passes to callbark
+ (err, req, res, next) => {
+ // custom error handler to catch any errors, such as TokenError
+ if (err.name === 'TokenError') {
+ res.redirect('http://nexusbr.com') // redirect them back to the login page
+ } else {
+ console.log('Falhou ao logar!')
+ // Handle other errors here
+ }
+ },
+ (req, res) => {
+ console.log('Logou com sucesso!')
+ // On success, redirect back to '/'
+ res.redirect('/surveys')
+ }
+ )
- router.get("/api/logout", (req,res)=>{
- req.logout();
- res.send(req.user);
- });
+ router.get('/api/logout', (req, res) => {
+ req.logout()
+ res.redirect('/')
+ })
- router.get("/api/current_user", (req, res)=> {
- res.send (req.user);
- });
-};
+ router.get('/api/current_user', (req, res) => {
+ res.send(req.user)
+ })
+}
--
libgit2 0.21.2