From 4985a0eb593422820e2cc9fea20048b762244082 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Tue, 25 Jun 2024 02:43:04 +0200 Subject: [PATCH] Fixed search page collapsing when not enough results. --- pages/search/+Page.vue | 1 + src/web/graphql.js | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/web/graphql.js diff --git a/pages/search/+Page.vue b/pages/search/+Page.vue index 87bd1f9..33dac13 100644 --- a/pages/search/+Page.vue +++ b/pages/search/+Page.vue @@ -105,6 +105,7 @@ const query = pageContext.urlParsed.search.q; .page { display: flex; flex-direction: column; + flex-grow: 1; } .row { diff --git a/src/web/graphql.js b/src/web/graphql.js new file mode 100644 index 0000000..ccae6b6 --- /dev/null +++ b/src/web/graphql.js @@ -0,0 +1,27 @@ +import { graphql, buildSchema } from 'graphql'; +import { scenesSchema, fetchScenesGraphql } from './scenes.js'; + +const schema = buildSchema(` + type Query { + scenes: [Scene] + } + + ${scenesSchema} +`); + +const rootValue = { + scenes: fetchScenesGraphql, +}; + +export async function graphqlApi(req, res) { + const data = await graphql({ + schema, + source: req.body.query, + variableValues: req.body.variables, + rootValue, + }); + + console.log(data); + + res.send(data); +}