add following and ui updates

This commit is contained in:
biglyderv 2024-11-25 14:12:43 -05:00
parent 95fde911c5
commit 7bec5f61f0
8 changed files with 75 additions and 23 deletions

View file

@ -6,7 +6,7 @@ let db = await initDb();
let main = new Route([auth], async function (req, res, input) {
let { username } = input;
let videos = await db.all('SELECT * FROM video ORDER BY date DESC', [
let videos = await db.all('SELECT * FROM video ORDER BY date DESC LIMIT 10', [
]);
return res.render('main', {
username,

View file

@ -9,10 +9,21 @@ let main = new Route([comment], async function (req, res, input) {
let videos = await db.all('SELECT * FROM video WHERE username = ? ORDER BY date DESC', [
req.query.id
]);
let followers = await db.all('SELECT * FROM follow WHERE target = ?', [
req.query.id
]);
let following = await db.all('SELECT * FROM follow WHERE username = ?', [
req.query.id
]);
return res.render('user', {
...input,
id,
videos
videos,
followers,
following
});
});