Skip to content

Commit

Permalink
Fix status issue when loading cms page
Browse files Browse the repository at this point in the history
  • Loading branch information
treoden committed Sep 1, 2024
1 parent be07e17 commit da81ef2
Showing 1 changed file with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
const { select } = require('@evershop/postgres-query-builder');
const { pool } = require('@evershop/evershop/src/lib/postgres/connection');
const {
setContextValue
} = require('../../../../graphql/services/contextHelper');
const {
getCmsPagesBaseQuery
} = require('../../../services/getCmsPagesBaseQuery');

module.exports = async (request, response, delegate, next) => {
try {
const query = select();
const query = getCmsPagesBaseQuery();
query
.from('cms_page')
.leftJoin('cms_page_description')
.on(
'cms_page.cms_page_id',
'=',
'cms_page_description.cms_page_description_cms_page_id'
);

query.where('cms_page_description.url_key', '=', request.params.url_key);
.where('cms_page_description.url_key', '=', request.params.url_key)
.and('cms_page.status', '=', 1);
const page = await query.load(pool);

if (page === null) {
response.status(404);
next();
Expand Down

0 comments on commit da81ef2

Please sign in to comment.