Skip to content

Commit

Permalink
fixed logout event listener
Browse files Browse the repository at this point in the history
  • Loading branch information
anaunique24 committed Jul 5, 2023
1 parent fc7c6f5 commit 9419e9a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions controllers/api/logoutRoutes.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// It was decided to handle user routes in three separate files: "loginRoutes", "logoutRoutes" and "signupRoutes".
// This is the logout route. I don't think we need the "const { User }" line because it is not reference in the route. I will remove this before submitting the final project.

const router = require('express').Router();
const { User } = require('../../models');
// const { User } = require('../../models');

router.post('/', (req, res) => {
if (req.session.logged_in) {
Expand Down
3 changes: 2 additions & 1 deletion public/js/logout.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const logout = async () => {
const response = await fetch('/api/logoutRoutes', {
// alert ('logout');
const response = await fetch('/api/logout', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
});
Expand Down
3 changes: 2 additions & 1 deletion views/chat.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.1.3/socket.io.js"
integrity="sha512-PU5S6BA03fRv1Q5fpwXjg5nlRrgdoguZ74urFInkbABMCENyx5oP3hrDzYMMPh3qdLdknIvrGj3yqZ4JuU7Nag=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="/js/chat.js"></script>
<script src="/js/chat.js"></script>
<script src="/js/logout.js"></script>

0 comments on commit 9419e9a

Please sign in to comment.