Skip to content

Commit

Permalink
Merge pull request #148 from madfish-solutions/hotfix-restore-ads
Browse files Browse the repository at this point in the history
[Hotfix] Restore ads with already implemented Cache-Control
  • Loading branch information
lourenc authored Feb 22, 2024
2 parents e00faa5 + 97aa689 commit 6d81b97
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
7 changes: 3 additions & 4 deletions src/routers/slise-ad-rules/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
getAllSliseAdProvidersBySites,
getSelectorsByProviderId,
getSliseAdProvidersByDomain,
// getSliseAdProvidersForAllSites,
getSliseAdProvidersForAllSites,
removeProviders,
removeSliseAdProvidersBySites,
removeSliseAdProvidersForAllSites,
Expand Down Expand Up @@ -157,10 +157,9 @@ sliseAdProvidersRouter
.route('/all-sites')
.get(
withExceptionHandler(async (_req, res) => {
// const providers = await getSliseAdProvidersForAllSites();
const providers = await getSliseAdProvidersForAllSites();

// res.status(200).send(providers);
res.status(200).header('Cache-Control', 'public, max-age=300').send([]);
res.status(200).header('Cache-Control', 'public, max-age=300').send(providers);
})
)
.post(
Expand Down
8 changes: 3 additions & 5 deletions src/utils/express-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ export const addObjectStorageMethodsToRouter = <V extends any[]>(
router.get(
path === '/' ? `/:${keyName}` : `${path}/:${keyName}`,
withExceptionHandler(async (req, res) => {
// const { [keyName]: key } = req.params;
const { [keyName]: key } = req.params;

// const value = await methods.getByKey(key);
const value = [];
const value = await methods.getByKey(key);

res.status(200).header('Cache-Control', 'public, max-age=300').send(value);
})
Expand All @@ -69,8 +68,7 @@ export const addObjectStorageMethodsToRouter = <V extends any[]>(
.route(path)
.get(
withExceptionHandler(async (_req, res) => {
// const values = await methods.getAllValues();
const values = {};
const values = await methods.getAllValues();

res.status(200).header('Cache-Control', 'public, max-age=300').send(values);
})
Expand Down

0 comments on commit 6d81b97

Please sign in to comment.