mirror of
https://github.com/LaconicNetwork/laconic.com.git
synced 2026-10-15 12:34:11 +00:00
Signed-off-by: Traxus <shyidx@gmail.com>
This commit is contained in:
@@ -33,7 +33,8 @@ export async function datocmsQueryIntercept(query: any) {
|
||||
} else if (pageQueryWhitelist.includes(parent)) {
|
||||
interceptData = await datocmsPageQueryIntercept(query)
|
||||
} else {
|
||||
interceptData = {error:
|
||||
interceptData = {
|
||||
error:
|
||||
'Unable to intercept datocms query. No viable JSON alternative was defined.'
|
||||
}
|
||||
}
|
||||
@@ -81,7 +82,10 @@ function getListingQueryDirectories(): string[] {
|
||||
|
||||
function pluckFirstParentFromQuery(query: any): string {
|
||||
//-----only plucks the FIRST parent, if there are multiple parents in the query they will be ignored.
|
||||
const parent: string = ((query.replace(/[\W_]+/g," ")).trim()).split(" ")[0]
|
||||
const parent: string = ((query
|
||||
.replace(/[\W_]+/g, ' '))
|
||||
.trim())
|
||||
.split(' ')[0]
|
||||
return parent
|
||||
}
|
||||
|
||||
@@ -110,7 +114,7 @@ async function datocmsListingQueryIntercept(query: any): Promise<any> {
|
||||
const parent: string = pluckFirstParentFromQuery(query)
|
||||
let jsonData: any = {}
|
||||
|
||||
switch(parent) {
|
||||
switch (parent) {
|
||||
case 'allBlogPosts':
|
||||
//-----blog listing is handled in its own annoyingly special way
|
||||
//-----could build it out here to be verbose but will not in the intrest of time/budget
|
||||
@@ -571,7 +575,7 @@ function getRequiedEventNodes() {
|
||||
}
|
||||
|
||||
function sortEventsJsonByStartDate(json: any[]) {
|
||||
let sortedJson: any[] = json
|
||||
const sortedJson: any[] = json
|
||||
.slice()
|
||||
.sort(
|
||||
(a: any, b: any) =>
|
||||
@@ -673,7 +677,7 @@ function getRequiedPressReleaseNodes() {
|
||||
}
|
||||
|
||||
function sortPressReleasesJsonByDate(json: any[]) {
|
||||
let sortedJson: any[] = json
|
||||
const sortedJson: any[] = json
|
||||
.slice()
|
||||
.sort(
|
||||
(a: any, b: any) => datocmsDateToIng(b.date) - datocmsDateToIng(a.date)
|
||||
@@ -738,8 +742,8 @@ async function getAllTeamsJson(): Promise<any> {
|
||||
pluckTeamData,
|
||||
validationNodes
|
||||
)
|
||||
let sortedTeams: any[] = sortTeamsJsonById(teams)
|
||||
let allTeamsJson = { allTeams: sortedTeams }
|
||||
const sortedTeams: any[] = sortTeamsJsonById(teams)
|
||||
const allTeamsJson = { allTeams: sortedTeams }
|
||||
|
||||
return allTeamsJson
|
||||
}
|
||||
@@ -789,7 +793,7 @@ async function getAllTestimonialsJson(): Promise<any> {
|
||||
validationNodes
|
||||
)
|
||||
const sortedTestimonals: any[] = sortTestimonialsJsonById(testimonials)
|
||||
const allTestimonialsJson = {allTestimonials: sortedTestimonals}
|
||||
const allTestimonialsJson = { allTestimonials: sortedTestimonals }
|
||||
|
||||
return allTestimonialsJson
|
||||
}
|
||||
@@ -118,7 +118,6 @@ export const getStaticProps: GetStaticProps = async (
|
||||
*/
|
||||
|
||||
async function getRelatedBlogPostsFromSource(): Promise<any> {
|
||||
|
||||
let relatedBlogPosts = {}
|
||||
|
||||
if (process.env.NEXT_PUBLIC_DATOCMS_BYPASS_TYPE === 'local_json') {
|
||||
|
||||
Reference in New Issue
Block a user