notherbase-fs 1.3.11 → 1.3.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,8 +22,13 @@ module.exports = function name(path)
22
22
  files.forEach(file => {
23
23
  file = file.slice(0, -4);
24
24
 
25
- router.get(`/${file}`, function(req, res) {
26
- res.render(`${path}/${file}.ejs`);
25
+ router.get(`/${file}`, async function(req, res) {
26
+ const foundUser = await db.user.findById(req.session.currentUser);
27
+
28
+ res.render(`${path}/${file}.ejs`, {
29
+ user: foundUser,
30
+ query: req.query
31
+ });
27
32
  });
28
33
  });
29
34
 
@@ -58,6 +58,15 @@ router.get("/logout", authCheck, async function(req, res) {
58
58
  }
59
59
  });
60
60
 
61
+ router.post("/logout", authCheck, async function(req, res) {
62
+ try {
63
+ await req.session.destroy();
64
+ }
65
+ catch {
66
+ console.log(err);
67
+ }
68
+ });
69
+
61
70
  router.get("/all", async function(req, res) {
62
71
  try {
63
72
  let foundUsers = await user.find({}, 'username coin home authLevels location attributes');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notherbase-fs",
3
- "version": "1.3.11",
3
+ "version": "1.3.13",
4
4
  "description": "Functions to help make developing for NotherBase easier.",
5
5
  "main": "notherbase-fs.js",
6
6
  "scripts": {