summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/shop.js18
1 files changed, 12 insertions, 6 deletions
diff --git a/scripts/shop.js b/scripts/shop.js
index 87ddc0c..e75d289 100644
--- a/scripts/shop.js
+++ b/scripts/shop.js
@@ -18,12 +18,18 @@ class Shop {
</section>
`
}
- for (let i = 0; i < output[0].length; i++) {
- data.body += `
- <div class='item'>
- <h2>${output[0][i].ProductName}</h2>
- <p>ID: ${output[0][i].ID}</p>
- </div>
+ if (output) {
+ for (let i = 0; i < output[0].length; i++) {
+ data.body += `
+ <div class='item'>
+ <h2>${output[0][i].ProductName}</h2>
+ <p>ID: ${output[0][i].ID}</p>
+ </div>
+ `
+ }
+ } else {
+ data.body = `
+ There are no items in the database.
`
}
return data.start + data.body + data.end