From f435946c55ff7de8a57b51bebac9aaa7a53870f1 Mon Sep 17 00:00:00 2001 From: Fabian Date: Sun, 22 Mar 2020 20:26:31 +0100 Subject: [PATCH] added logout route + AnalyticsCard File --- backend/app.js | 2 +- backend/routes/users/index.js | 12 +++++++++++ frontend/src/api.js | 2 +- frontend/src/components/AnalyticsCard.vue | 26 +++++++++++++++++++++++ frontend/src/views/Dashboard.vue | 19 +++++------------ 5 files changed, 45 insertions(+), 16 deletions(-) create mode 100644 frontend/src/components/AnalyticsCard.vue diff --git a/backend/app.js b/backend/app.js index c72fb26..11e33fe 100644 --- a/backend/app.js +++ b/backend/app.js @@ -7,9 +7,9 @@ const jwt_secret = "jwt_secret"; const apiRoute = require("./routes/index"); - const port = process.env.port || 3000; + app.use(cookieParser()); app.use( (req, res, next) => { diff --git a/backend/routes/users/index.js b/backend/routes/users/index.js index 17b1674..d247bc3 100644 --- a/backend/routes/users/index.js +++ b/backend/routes/users/index.js @@ -94,4 +94,16 @@ router.get('/loggedIn', (req, res) => { } }); +router.get('/logout', (req, res) => { + console.log(req.user); + if(req.user && req.user.ID) { + res.clearCookie('token', { + secure: false, + httpOnly: true, + //sameSite: 'None' + }).json({ success: 'Logout was successful'}); + //res.status(200).json({ success: 'Log out was successful'}); + } +}); + module.exports = router; diff --git a/frontend/src/api.js b/frontend/src/api.js index 1c0acc5..f7c42b2 100644 --- a/frontend/src/api.js +++ b/frontend/src/api.js @@ -1,6 +1,6 @@ import deepmerge from "deepmerge"; import { store } from "@/store"; -const baseUrl = "https://vision.owlabout.de/api"; +const baseUrl = /*"https://vision.owlabout.de/api";*/ 'http://localhost:9000/api/' function base(path, options = {}) { return fetch( diff --git a/frontend/src/components/AnalyticsCard.vue b/frontend/src/components/AnalyticsCard.vue new file mode 100644 index 0000000..2711cad --- /dev/null +++ b/frontend/src/components/AnalyticsCard.vue @@ -0,0 +1,26 @@ + + + + + diff --git a/frontend/src/views/Dashboard.vue b/frontend/src/views/Dashboard.vue index d17966f..b55e2ba 100644 --- a/frontend/src/views/Dashboard.vue +++ b/frontend/src/views/Dashboard.vue @@ -11,13 +11,7 @@ -
-
-

Analytics

-
-
- -
+

Empfohlen für dich

@@ -99,10 +93,13 @@ @@ -181,10 +178,4 @@ ul { background-size: cover; background-position: 100px -100px; } -.analytics { - background: url("../assets/form-blue.svg"); - background-repeat: no-repeat; - background-size: cover; - background-position: -150px -80px; -}