diff --git a/lib/api/routes/jobRouter.js b/lib/api/routes/jobRouter.js
index 56553e2..9113078 100644
--- a/lib/api/routes/jobRouter.js
+++ b/lib/api/routes/jobRouter.js
@@ -173,7 +173,7 @@ jobRouter.post('/', async (req, res) => {
return;
}
- if (settings.demoMode && jobFromDb.name === DEMO_JOB_NAME) {
+ if (settings.demoMode && jobFromDb && jobFromDb.name === DEMO_JOB_NAME) {
res.send(new Error('Sorry, but you cannot change the Status of our Demo Job ;)'));
return;
}
diff --git a/lib/api/routes/listingsRouter.js b/lib/api/routes/listingsRouter.js
index 4de113d..82817dd 100644
--- a/lib/api/routes/listingsRouter.js
+++ b/lib/api/routes/listingsRouter.js
@@ -10,6 +10,7 @@ import { isAdmin as isAdminFn } from '../security.js';
import logger from '../../services/logger.js';
import { nullOrEmpty } from '../../utils.js';
import { getJobs } from '../../services/storage/jobStorage.js';
+import { getSettings } from '../../services/storage/settingsStorage.js';
const service = restana();
@@ -107,7 +108,13 @@ listingsRouter.post('/watch', async (req, res) => {
listingsRouter.delete('/job', async (req, res) => {
const { jobId } = req.body;
+ const settings = await getSettings();
try {
+ if (settings.demoMode) {
+ res.send(new Error('Sorry, but you cannot remove listings in demo mode ;)'));
+ return;
+ }
+
listingStorage.deleteListingsByJobId(jobId);
} catch (error) {
res.send(new Error(error));
diff --git a/package.json b/package.json
index b93ff4d..7173f1a 100755
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "fredy",
- "version": "19.3.1",
+ "version": "19.3.2",
"description": "[F]ind [R]eal [E]states [d]amn eas[y].",
"scripts": {
"prepare": "husky",
diff --git a/ui/src/views/listings/ListingDetail.jsx b/ui/src/views/listings/ListingDetail.jsx
index ff0da5f..d0762de 100644
--- a/ui/src/views/listings/ListingDetail.jsx
+++ b/ui/src/views/listings/ListingDetail.jsx
@@ -315,7 +315,7 @@ export default function ListingDetail() {
>
{listing.isWatched === 1 ? 'Watched' : 'Watch'}
-