Skip to content

Commit 8377a0c

Browse files
committed
chore: fix a nextjs example
1 parent e6d8ba8 commit 8377a0c

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

examples/nextjs-app/app/components/Pets.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

3+
import { useFindPets } from "@/openapi/queries";
34
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
4-
import { useFindPets } from "../openapi/queries";
55

66
export default function Pets() {
77
const { data } = useFindPets({

examples/nextjs-app/app/page.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@ import {
66
import Link from "next/link";
77
import { prefetchUseFindPets } from "../openapi/queries/prefetch";
88
import Pets from "./components/Pets";
9-
import { client } from "./providers";
109

1110
export default async function Home() {
1211
const queryClient = new QueryClient();
1312

1413
await prefetchUseFindPets(queryClient, {
1514
query: { tags: [], limit: 10 },
16-
client: client,
1715
});
1816

1917
return (

examples/nextjs-app/app/providers.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"use client";
22

3-
import { createClient } from "@hey-api/client-fetch";
43
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
4+
import "../fetchClient";
5+
56
// We can not useState or useRef in a server component, which is why we are
67
// extracting this part out into
78

@@ -32,10 +33,6 @@ function getQueryClient() {
3233
return browserQueryClient;
3334
}
3435

35-
export const client = createClient({
36-
baseUrl: "http://localhost:4010",
37-
});
38-
3936
export default function Providers({ children }: { children: React.ReactNode }) {
4037
// NOTE: Avoid useState when initializing the query client if you don't
4138
// have a suspense boundary between this and the code that may

examples/nextjs-app/fetchClient.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { client } from "@/openapi/requests/services.gen";
2+
3+
client.setConfig({
4+
baseUrl: "http://localhost:4010",
5+
});

0 commit comments

Comments
 (0)