notherbase-fs 1.3.8 → 1.3.9

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.
@@ -42,7 +42,8 @@ const explorer = async function explorer(worldPath, voidPath) {
42
42
  try {
43
43
  let currentRoute = `${req.params.region}/${req.params.area}/${req.params.poi}/${req.params.detail}`;
44
44
 
45
- if (await db.poi.exists({ route: currentRoute, user: req.session.currentUser }) === false) {
45
+ let exists = await db.poi.exists({ route: currentRoute, user: req.session.currentUser });
46
+ if (!exists) {
46
47
  await db.poi.create({
47
48
  route: currentRoute,
48
49
  name: req.params.detail,
@@ -54,8 +55,7 @@ const explorer = async function explorer(worldPath, voidPath) {
54
55
 
55
56
  let found = await db.poi.findOne({ route: currentRoute, user: req.session.currentUser });
56
57
 
57
- if (found) res.send(found.data);
58
- else res.send("Found nothing.");
58
+ res.send(found.data);
59
59
  }
60
60
  catch(err) {
61
61
  console.log(err);
@@ -67,15 +67,14 @@ const explorer = async function explorer(worldPath, voidPath) {
67
67
  try {
68
68
  let currentRoute = `${req.params.region}/${req.params.area}/${req.params.poi}/${req.params.detail}`;
69
69
 
70
- if (await db.poi.exists({ route: currentRoute, user: req.session.currentUser }) === false) {
71
- await db.poi.create({
72
- route: currentRoute,
73
- name: req.params.detail,
74
- type: "user",
75
- user: req.session.currentUser,
76
- data: {}
77
- });
78
- }
70
+ let exists = await db.poi.exists({ route: currentRoute, user: req.session.currentUser });
71
+ if (!exists) await db.poi.create({
72
+ route: currentRoute,
73
+ name: req.params.detail,
74
+ type: "user",
75
+ user: req.session.currentUser,
76
+ data: {}
77
+ });
79
78
 
80
79
  await db.poi.updateOne({ route: currentRoute, user: req.session.currentUser }, { data: req.body });
81
80
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notherbase-fs",
3
- "version": "1.3.8",
3
+ "version": "1.3.9",
4
4
  "description": "Functions to help make developing for NotherBase easier.",
5
5
  "main": "notherbase-fs.js",
6
6
  "scripts": {
@@ -4,4 +4,14 @@
4
4
 
5
5
  <a href="/the-front">
6
6
  Go to The Front
7
- </a>
7
+ </a>
8
+
9
+ <script>
10
+ // $.post("/forest/eye-of-the-forest/square/test/save", {
11
+ // test: 36
12
+ // });
13
+
14
+ // $.get("/forest/eye-of-the-forest/square/test/load", function (data) {
15
+ // console.log(data);
16
+ // });
17
+ </script>