Skip to content

Commit

Permalink
chore: add tanstack query v4
Browse files Browse the repository at this point in the history
  • Loading branch information
iansamz committed Jul 25, 2023
1 parent ac792ca commit c04dea6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
1 change: 1 addition & 0 deletions next-react-query-tailwind/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"dependencies": {
"@headlessui/react": "1.7.15",
"@heroicons/react": "2.0.18",
"@tanstack/react-query": "4.32.0",
"classnames": "2.3.2",
"date-fns": "2.30.0",
"graphql": "16.7.1",
Expand Down
10 changes: 1 addition & 9 deletions next-react-query-tailwind/src/pages/api/graphql.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import type { NextApiRequest, NextApiResponse } from 'next';
// import { getToken } from 'next-auth/jwt';
// import { getJwtOptions } from '@lib/jwt';
import { getServerSession } from 'next-auth/next';
import { authOptions } from './auth/[...nextauth]';

Expand All @@ -16,21 +14,15 @@ async function handler(req: NextApiRequest, res: NextApiResponse<any>) {

const session = await getServerSession(req, res, authOptions);

// const token = await getToken({
// req,
// // ...getJwtOptions(),
// });

if (session === null) {
return res.status(401).json({ message: 'Unauthorized' });
}

try {
console.log('session', session);
const data = await fetch(GRAPHQL_ENDPOINT, {
method: 'POST',
headers: {
authorization: `Bearer ${session?.user.accessToken}`,
authorization: `Bearer ${session?.user?.accessToken}`,
},
body: JSON.stringify(req.body),
});
Expand Down
20 changes: 19 additions & 1 deletion next-react-query-tailwind/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1470,7 +1470,7 @@
auto-bind "~4.0.0"
tslib "~2.5.0"

"@graphql-codegen/typescript-react-query@^4.1.0":
"@graphql-codegen/[email protected]":
version "4.1.0"
resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript-react-query/-/typescript-react-query-4.1.0.tgz#42dc8a90472c259f9bbacfdf944899c6e0cebcc9"
integrity sha512-+3Hk+ws6HfCAZl7+5Q4LBkFh3y+2ISuahMYRHIqzqpwNnrthftg8xNx11VH5sabqqjqEmjY3UaP8glP93itPWQ==
Expand Down Expand Up @@ -3389,6 +3389,19 @@
lodash.merge "^4.6.2"
postcss-selector-parser "6.0.10"

"@tanstack/[email protected]":
version "4.32.0"
resolved "https://registry.yarnpkg.com/@tanstack/query-core/-/query-core-4.32.0.tgz#e0f4a830283612430450c13badd353766423f523"
integrity sha512-ei4IYwL2kmlKSlCw9WgvV7PpXi0MiswVwfQRxawhJA690zWO3dU49igaQ/UMTl+Jy9jj9dK5IKAYvbX7kUvviQ==

"@tanstack/react-query@^4.32.0":
version "4.32.0"
resolved "https://registry.yarnpkg.com/@tanstack/react-query/-/react-query-4.32.0.tgz#701b45b149cfd4b54a68705f9100973db3ba5d5d"
integrity sha512-B8WUMcByYAH9500ENejDCATOmEZhqjtS9wsfiQ3BNa+s+yAynY8SESI8WWHhSqUmjd0pmCSFRP6BOUGSda3QXA==
dependencies:
"@tanstack/query-core" "4.32.0"
use-sync-external-store "^1.2.0"

"@testing-library/dom@^9.0.0":
version "9.3.1"
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-9.3.1.tgz#8094f560e9389fb973fe957af41bf766937a9ee9"
Expand Down Expand Up @@ -12922,6 +12935,11 @@ use-resize-observer@^9.1.0:
dependencies:
"@juggle/resize-observer" "^3.3.1"

use-sync-external-store@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a"
integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==

util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
Expand Down

0 comments on commit c04dea6

Please sign in to comment.