aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/routes/index.js7
-rw-r--r--src/views/home.pug13
2 files changed, 6 insertions, 14 deletions
diff --git a/src/routes/index.js b/src/routes/index.js
index 8e9c876..bb030b3 100644
--- a/src/routes/index.js
+++ b/src/routes/index.js
@@ -12,7 +12,12 @@ const G = new geddit.Geddit();
12 12
13// GET / 13// GET /
14router.get("/", authenticateToken, async (req, res) => { 14router.get("/", authenticateToken, async (req, res) => {
15 res.render("home"); 15 const subs = db
16 .query("SELECT * FROM subscriptions WHERE user_id = $id")
17 .all({ id: req.user.id });
18 const p = subs.map((s) => s.subreddit).join("+");
19 console.log(p);
20 res.redirect(`/r/${p}`);
16}); 21});
17 22
18// GET /r/:id 23// GET /r/:id
diff --git a/src/views/home.pug b/src/views/home.pug
deleted file mode 100644
index b997ebb..0000000
--- a/src/views/home.pug
+++ /dev/null
@@ -1,13 +0,0 @@
1include ../mixins/sub
2doctype html
3html
4 +subMgmt()
5 script(async).
6 window.addEventListener("load", () => {
7 const url = getSubs().join('+');
8 if (url) {
9 window.location.href = `/r/${url}`;
10 } else {
11 window.location.href = '/r/all';
12 }
13 });