Skip to content

Commit b6e601f

Browse files
author
Christian Martinez
committed
Still debugging
1 parent d0c8ac2 commit b6e601f

File tree

1 file changed

+1
-31
lines changed

1 file changed

+1
-31
lines changed

controllers/api/user-routes.js

+1-31
Original file line numberDiff line numberDiff line change
@@ -36,38 +36,8 @@ router.post('/login', async (req, res) => {
3636
req.session.save(() => {
3737
req.session.user_id = userData.dataValues.id
3838
req.session.logged_in = true
39+
res.redirect('/dashboard')
3940
})
40-
41-
const allPosts = await Post.findAll({
42-
where: {
43-
user_id: userData.dataValues.id,
44-
},
45-
attributes: ['id', 'post_text', 'title', 'created_on'],
46-
include: [
47-
{
48-
model: Comment,
49-
attributes: [
50-
'id',
51-
'comment_text',
52-
'post_id',
53-
'user_id',
54-
'created_on',
55-
],
56-
include: {
57-
model: User,
58-
attributes: ['full_name'],
59-
},
60-
},
61-
{
62-
model: User,
63-
attributes: ['full_name'],
64-
},
65-
],
66-
})
67-
68-
const posts = allPosts.map((post) => post.get({ plain: true }))
69-
70-
res.render('dashboard', { posts, logged_in: true })
7141
} catch (err) {
7242
console.log(err)
7343
res.status(500).json(err)

0 commit comments

Comments
 (0)