-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
+
+ +
diff --git a/src/routes/forms.js b/src/routes/forms.js index abc654c..dc3da4a 100644 --- a/src/routes/forms.js +++ b/src/routes/forms.js @@ -5,12 +5,15 @@ const func = require('../functions') const router = express.Router(); ///////////////////// Form pages //////////////////////////// +// new post router.get(`${config.site_path}/${config.new_post_url}`, (req,res) => { res.render("forms/new_post", { config, locale, }); }); // /post + +// signup router.get(`${config.site_path}/${config.signup_url}`, (req,res) => { // if the server does allow signup if (config.allow_signup == true) { @@ -33,20 +36,24 @@ router.get(`${config.site_path}/${config.signup_url}`, (req,res) => { console.log("Error, invalid value for allow_signup (bool)") } }); // /signup + +// edit account router.get(`${config.site_path}/${config.edit_account_base_url}/:user_id`, (req,res) => { const userID = parseInt(req.params.user_id); res.render("forms/edit_account", { config, locale, - user: data.getdata('users', 'id', userID), + user: data.getdata('users', 'id', userID)[0], userID }); }); // /delete_account + +// edit post router.get(`${config.site_path}/${config.edit_post_base_url}/:post_id`, (req,res) => { const postID = req.params.post_id - const post = data.getdata('posts','id', postID) - const user = data.getdata('users', 'id', post.userID) + const post = data.getdata('posts','id', postID)[0] + const user = data.getdata('users', 'id', post.userID)[0] res.render("forms/edit_post", { config, diff --git a/src/routes/standard_pages.js b/src/routes/standard_pages.js index c5c599b..e5f8ad0 100644 --- a/src/routes/standard_pages.js +++ b/src/routes/standard_pages.js @@ -118,7 +118,7 @@ router.get(`${config.site_path}/comment/:postID-:commentID`, (req,res) => { const commentID = parseInt(req.params.commentID); const postID = parseInt(req.params.postID); - let posts_comments = data.getdata('comments', 'id', postID)["comments"] + let posts_comments = data.getdata('comments', 'id', postID)[0]["comments"] let comment = 1 // For loop to find the comment with matching ID posts_comments.forEach((current_comment, index) => { diff --git a/views/forms/edit_account.ejs b/views/forms/edit_account.ejs index e966c93..dec20d6 100644 --- a/views/forms/edit_account.ejs +++ b/views/forms/edit_account.ejs @@ -1,22 +1,27 @@ - -
- <%- include("../partials/head") %> - - -