Skip to content

Commit

Permalink
update GraphqlPage.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
mitch1009 committed May 4, 2024
1 parent dcd838c commit 2fddc46
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/components/Hello/GraphqlPage.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
import React from 'react'
import { env } from 'process'
export default async function GraphqlPage() {
const data = await fetch(`${env.AUTH_URL}/api/graphql`,
{
method: "POST",
body: JSON.stringify({
query: `query Query($name: String="graphql") { hello(name: $name) }
`,
}),
headers: {
"Content-Type": "application/json",
},
}
).then((res) => res.json());
return (
<div className='text-2xl rounded-md p-8 border border-dashed mx-auto max-w-3xl bg-gray-100 my-8'>
Graphql Server
data && <div className='text-2xl rounded-md p-8 border border-dashed mx-auto max-w-3xl bg-gray-100 my-8'>
{data.data.hello}
</div>
)
}

0 comments on commit 2fddc46

Please sign in to comment.