diff options
Diffstat (limited to 'src/routes/index.js')
-rw-r--r-- | src/routes/index.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/routes/index.js b/src/routes/index.js index 93ebf46..6153692 100644 --- a/src/routes/index.js +++ b/src/routes/index.js | |||
@@ -82,10 +82,10 @@ router.post("/register", async (req, res) => { | |||
82 | return res.status(400).send("Passwords do not match"); | 82 | return res.status(400).send("Passwords do not match"); |
83 | } | 83 | } |
84 | try { | 84 | try { |
85 | db.run("INSERT INTO users (username, password) VALUES (?, ?)", [ | 85 | db.query("INSERT INTO users (username, password) VALUES (?, ?)", [ |
86 | username, | 86 | username, |
87 | password, | 87 | password, |
88 | ]); | 88 | ]).run(); |
89 | res.status(201).send("User registered successfully"); | 89 | res.status(201).send("User registered successfully"); |
90 | } catch (err) { | 90 | } catch (err) { |
91 | console.log(err); | 91 | console.log(err); |
@@ -125,10 +125,10 @@ router.post("/subscribe", async (req, res) => { | |||
125 | if (existingSubscription) { | 125 | if (existingSubscription) { |
126 | res.status(400).send("Already subscribed to this subreddit"); | 126 | res.status(400).send("Already subscribed to this subreddit"); |
127 | } else { | 127 | } else { |
128 | db.run("INSERT INTO subscriptions (user_id, subreddit) VALUES (?, ?)", [ | 128 | db.query("INSERT INTO subscriptions (user_id, subreddit) VALUES (?, ?)", [ |
129 | user.id, | 129 | user.id, |
130 | subreddit, | 130 | subreddit, |
131 | ]); | 131 | ]).run(); |
132 | res.status(201).send("Subscribed successfully"); | 132 | res.status(201).send("Subscribed successfully"); |
133 | } | 133 | } |
134 | } else { | 134 | } else { |