-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e033a1f
commit 7000701
Showing
3 changed files
with
98 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { gql } from "@urql/core"; | ||
import queryAPI from "@/lib/api/client/query"; | ||
|
||
export async function getGalleryData( | ||
uri: string, | ||
searchParams: any | ||
// section: string, | ||
// type: string, | ||
// locale: string, | ||
// previewToken?: string | ||
) { | ||
// const site = getSiteFromLocale(locale); | ||
// const query = getQueryFragments(uri, section, type, site); | ||
const query = getQuery(searchParams?.sort); | ||
console.info(query); | ||
|
||
const { data } = await queryAPI({ | ||
query, | ||
variables : {}, | ||
// variables: { | ||
// section, | ||
// type, | ||
// site, | ||
// uri: decodeURI(uri), | ||
// }, | ||
// previewToken, | ||
}); | ||
|
||
// Get the related investigation | ||
// const entryWithRelatedData = await includeRelatedEntries(data.entry, site); | ||
return cleanUpQueryResponse(data); | ||
} | ||
|
||
function cleanUpQueryResponse(response) { | ||
return response?.entries.filter( e => Object.keys(e).length !== 0); | ||
} | ||
|
||
function getQuery(sort) { | ||
let sortArg = ""; | ||
if (sort != undefined && sort != null) { | ||
if (sort == "asc") { | ||
sortArg = "(sortBy: \"default.DateCreated\")"; | ||
} else { | ||
sortArg = "(sortByDesc: \"default.DateCreated\")"; | ||
} | ||
} | ||
return gql` | ||
query MyQuery { | ||
entries { | ||
... on galleryItems_galleryItem_Entry { | ||
id | ||
title | ||
albumAsGallery${sortArg} { | ||
id | ||
approvalStatus | ||
owner | ||
size | ||
smartTags | ||
url { | ||
HighJPG | ||
} | ||
additional { | ||
AltTextEN | ||
AltTextES | ||
CaptionEN | ||
CaptionES | ||
Credit | ||
Description | ||
} | ||
default { | ||
DateCreated | ||
Author | ||
Copyright | ||
} | ||
} | ||
} | ||
} | ||
}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
"static": "npm-run-all static:*", | ||
"static:build": "next build --debug", | ||
"static:export": "next export", | ||
"start": "next start -p 8080", | ||
"start": "next start -p 3000", | ||
"bs": "next build && next start -p 3000", | ||
"prepare": "husky install", | ||
"precommit": "lint-staged", | ||
|
@@ -151,5 +151,6 @@ | |
"tsconfig-paths-webpack-plugin": "^4.0.1", | ||
"typescript": "^5.6.2", | ||
"typescript-plugin-css-modules": "^5.1.0" | ||
} | ||
}, | ||
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" | ||
} |