Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Commit

Permalink
added logout route + AnalyticsCard File
Browse files Browse the repository at this point in the history
  • Loading branch information
heinzef committed Mar 22, 2020
1 parent 183ac86 commit f435946
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 16 deletions.
2 changes: 1 addition & 1 deletion backend/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
12 changes: 12 additions & 0 deletions backend/routes/users/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion frontend/src/api.js
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
26 changes: 26 additions & 0 deletions frontend/src/components/AnalyticsCard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<template>
<div class="card card-lg analytics">
<div class="card-body">
<h2>Analytics2</h2>
</div>
<div class="card-body"></div>
<div class="card-footer"></div>
</div>
</template>

<script>
export default {
props: {
track: Object
}
};
</script>

<style lang="scss" scoped>
.analytics {
background: url("../assets/form-blue.svg");
background-repeat: no-repeat;
background-size: cover;
background-position: -150px -80px;
}
</style>
19 changes: 5 additions & 14 deletions frontend/src/views/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@
<button class="btn">Kurs fortführen</button>
</div>
</div>
<div class="card card-lg analytics">
<div class="card-body">
<h2>Analytics</h2>
</div>
<div class="card-body"></div>
<div class="card-footer"></div>
</div>
<AnalyticsCard />
<div class="card recommendations">
<div class="card-header">
<h2>Empfohlen für dich</h2>
Expand Down Expand Up @@ -99,10 +93,13 @@
<script>
// @ is an alias to /src
import HelloWorld from "@/components/HelloWorld.vue";
import AnalyticsCard from "../components/AnalyticsCard.vue";
export default {
name: "Home",
components: {}
components: {
AnalyticsCard
}
};
</script>

Expand Down Expand Up @@ -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;
}
</style>

0 comments on commit f435946

Please sign in to comment.