Skip to content

Commit

Permalink
how about now?
Browse files Browse the repository at this point in the history
tonyfischetti committed Dec 18, 2024
1 parent 661f046 commit 29c5bcd
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Prints and Photographs Discovery tool",
"version": "2.1.1",
"version": "2.1.2",
"private": true,
"scripts": {
"dev": "next dev",
2 changes: 2 additions & 0 deletions pages/api/v1/main/dtajax/index.ts
Original file line number Diff line number Diff line change
@@ -35,11 +35,13 @@ export const performAJAX = (params: DTAJAXParams) => {

export const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const impossibleErrorMessage = "couldn't read NextRequest.URL string";
res.setHeader('Content-Type', 'application/json');

return Promise.resolve(req.url ?? impossibleErrorMessage).
then(_ => { if (req.url !== undefined) return req.url; throw new Error(impossibleErrorMessage) }).
then(getParamsAsObject).
then(performAJAX).
then(_ => { console.log("AJAX"); console.log(_); console.log("END"); return _ }).
then(result => res.status(200).json(result)).
catch(e => res.status(500).json({ error: e.message }));
}

0 comments on commit 29c5bcd

Please sign in to comment.