From ac5c86b8b521cc94755e57c4efaf5a92541bd0e6 Mon Sep 17 00:00:00 2001 From: Mr Swift Date: Mon, 19 Aug 2024 13:39:23 +0330 Subject: [PATCH] Fix sw error --- server/controllers/userController.js | 4 ++-- static/CustomSW.js | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/controllers/userController.js b/server/controllers/userController.js index 1cb7ac9..d5c1f91 100644 --- a/server/controllers/userController.js +++ b/server/controllers/userController.js @@ -952,7 +952,7 @@ module.exports.confirmMobile = [ /// //////////////////////////////////////////////////////////////////// user managemnet by admin module.exports.get_all_users_for_admin = [ - (req, res) => { + (req, res) => { User.find( { scope: ['user'], @@ -962,7 +962,7 @@ module.exports.get_all_users_for_admin = [ }, (err, data) => { if (err) return res500(res, err) - return res.json(data) + return res.status(200).json(data) } ) } diff --git a/static/CustomSW.js b/static/CustomSW.js index 96b1c22..b08ae69 100644 --- a/static/CustomSW.js +++ b/static/CustomSW.js @@ -9,12 +9,12 @@ const closePwaDialogBtn = document.querySelector('#closePwaDialog') // functions function showCustomInstallPromotion() { setTimeout(function() { - customDialog.classList.add('active') + customDialog?.classList.add('active') }, 500) } function hideCustomInstallPromotion() { setTimeout(function() { - customDialog.classList.remove('active') + customDialog?.classList.remove('active') }, 500) } @@ -30,11 +30,11 @@ window.addEventListener('beforeinstallprompt', e => { }) events.forEach(evt => { - closePwaDialogBtn.addEventListener(evt, e => { + closePwaDialogBtn?.addEventListener(evt, e => { hideCustomInstallPromotion() }) - installBtn.addEventListener(evt, e => { + installBtn?.addEventListener(evt, e => { // Hide the app provided install promotion hideCustomInstallPromotion() // Show the install prompt @@ -50,7 +50,7 @@ events.forEach(evt => { }) try { - showPwaDialogBtn.addEventListener(evt, e => { + showPwaDialogBtn?.addEventListener(evt, e => { if (deferredPrompt) { showCustomInstallPromotion() } else {