Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

Commit e52a508

Browse files
committed
Add query handling for custom settings pages
1 parent 4f1c2b1 commit e52a508

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import queryError404Page from '../pages/queryError404Page'
2+
import processPostTypeQuery from './processPostTypeQuery'
3+
4+
/**
5+
* Retrieve single page set via Additional Settings.
6+
*
7+
* @author WebDevStudios
8+
* @param {string} page Custom page name in settings.
9+
* @return {object} Object containing Apollo client instance and post data or error object.
10+
*/
11+
export default async function getSettingsCustomPage(page) {
12+
// Define single page query based on page name.
13+
const pageQuery = {
14+
404: queryError404Page
15+
}
16+
17+
// Retrieve page query.
18+
const query = pageQuery?.[page] ?? null
19+
20+
return processPostTypeQuery('page', page, query)
21+
}

0 commit comments

Comments
 (0)