Skip to content

Commit

Permalink
Fixed refresh delete bug
Browse files Browse the repository at this point in the history
  • Loading branch information
am1t committed Jul 20, 2018
1 parent b2503d9 commit 32bdba7
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions routes/discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ router.get('/user/:userid', ensureAuthenticated, async (req, res, next) => {
const author = user_info.author;
const posts = await fetch_posts_by_type(user_info.items);

author.avatar = author.avatar.toString().split("?")[0];
author.userid = req.params.userid;
author.bio = marked(user_info._microblog.bio);

Expand Down Expand Up @@ -167,4 +168,40 @@ router.post('/user/follow', ensureAuthenticated, async (req, res) => {
}
});

const parse_interactions = function(interactions){
var recs = new Map();
return new Promise((resolve, reject) => {
try {
interactions.forEach(item => {

});
resolve(recs)
} catch (error) {
reject(error);
}
});
}

// Discover User Route
router.get('/thread', ensureAuthenticated, async (req, res, next) => {
let errors = [];
try {
var app_token = CryptoJS.AES.decrypt(req.user.token, appconfig.seckey).toString(CryptoJS.enc.Utf8);

const stream = await fetch_stream(app_token);
const posts = await fetch_posts_by_type(stream.items);
var interactions = posts.interactions;

const threads_recs = await parse_interactions(interactions);


} catch (error) {
console.log(error);
errors.push({text:"Failed to fetch thread discover"});
res.render('discover/landing', {
errors: errors
})
}
});

module.exports = router;

0 comments on commit 32bdba7

Please sign in to comment.