[bug] fix cache - don't use for admins

This commit is contained in:
Andrea Vos 2021-07-13 01:09:13 +02:00
parent 413237152a
commit 9566eee609
4 changed files with 5 additions and 5 deletions

View File

@ -32,7 +32,7 @@ router.get('/inclusive', handleErrorAsync(async (req, res) => {
AND i.approved >= ${req.isGranted('inclusive') ? 0 : 1}
AND i.deleted = 0
`), 'insteadOf');
}));
}, !req.isGranted('inclusive')));
}));
router.get('/inclusive/search/:term', handleErrorAsync(async (req, res) => {

View File

@ -80,7 +80,7 @@ router.get('/nouns', handleErrorAsync(async (req, res) => {
AND n.approved >= ${req.isGranted('nouns') ? 0 : 1}
ORDER BY n.approved, n.masc
`))
}));
}, !req.isGranted('nouns')));
}));
router.get('/nouns/search/:term', handleErrorAsync(async (req, res) => {

View File

@ -32,7 +32,7 @@ router.get('/terms', handleErrorAsync(async (req, res) => {
AND i.approved >= ${req.isGranted('terms') ? 0 : 1}
AND i.deleted = 0
`), 'term');
}));
}, !req.isGranted('terms')));
}));
router.get('/terms/search/:term', handleErrorAsync(async (req, res) => {

View File

@ -8,8 +8,8 @@ export class CacheObject {
this.maxAgeMinutes = maxAgeMinutes;
}
async fetch(generator) {
if (process.env.NODE_ENV === 'development') {
async fetch(generator, enabled = true) {
if (process.env.NODE_ENV === 'development' || !enabled) {
return await generator();
}