diff --git a/form/follow.js b/form/follow.js index 3ce8943..cc5a782 100644 --- a/form/follow.js +++ b/form/follow.js @@ -26,15 +26,14 @@ let main = new Route([auth], async function (req, res, input) { username, target ]); + res.send({'success': true, 'message': 'User unfollowed'}); } else { await db.run('INSERT INTO follow (username,target) VALUES (?,?)', [ username, target ]); + res.send({'success': true, 'message': 'User followed'}); } - - - res.send({ redir: `?` }); }); export default main; \ No newline at end of file diff --git a/static/main.js b/static/main.js index ca61fa2..32a7ee5 100644 --- a/static/main.js +++ b/static/main.js @@ -16,7 +16,7 @@ async function formClick(ev) { let json = await fetched.json(); - document.querySelector('.form-message').textContent = json.message; + target.querySelector('.form-message').textContent = json.message; if (json.redirect) { setTimeout(function () { diff --git a/views/user.ejs b/views/user.ejs index a2e2a73..5b58753 100644 --- a/views/user.ejs +++ b/views/user.ejs @@ -1,20 +1,27 @@ <%- include('header.ejs') -%> -
+

User

- +
+

@<%= id %>

-

- <%= following.length %> following -

-

- <%= followers.length %> followers -

+
+ <%= following.length %> following + <% for (let user of following) { %> + <%= user.target %> + <%} %> +
+
+ <%= followers.length %> followers + <% for (let user of followers) { %> + <%= user.username %> + <%} %> +
- -
+
+

Uploaded Videos