Add queryClient

This commit is contained in:
Иван 2025-12-14 14:30:54 +03:00
parent c592ba9eaf
commit 85c23f136e
5 changed files with 901 additions and 746 deletions

1602
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -44,6 +44,7 @@
"eslint": "^9", "eslint": "^9",
"eslint-config-next": "15.5.5", "eslint-config-next": "15.5.5",
"tailwindcss": "^4", "tailwindcss": "^4",
"turbo": "^2.6.3",
"typescript": "^5" "typescript": "^5"
} }
} }

View File

@ -15,7 +15,7 @@ const useAuthentificate = () => {
return useMutation({ return useMutation({
mutationKey: ["auth"], mutationKey: ["auth"],
mutationFn: async (authData: AuthDataType) => { mutationFn: async (authData: AuthDataType) => {
const response = await client.post("/api/auth/login/", authData); const response = await client.post("/auth/login/", authData);
const { access_token } = await response.data; const { access_token } = await response.data;

View File

@ -3,26 +3,29 @@ import { Inter } from "next/font/google";
import "./globals.css"; import "./globals.css";
import Header from "@/components/layout/Header"; import Header from "@/components/layout/Header";
import Footer from "@/components/layout/Footer"; import Footer from "@/components/layout/Footer";
import Providers from "./providers";
const inter = Inter({ subsets: ["latin", "cyrillic"] }); // Поддержка русского const inter = Inter({ subsets: ["latin", "cyrillic"] });
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Travel Marine - Аренда яхт в Балаклаве", title: "Travel Marine - Аренда яхт в Балаклаве",
description: "Прокат яхт и морские прогулки в Балаклаве", description: "Прокат яхт и морские прогулки в Балаклаве",
}; };
export default function RootLayout({ export default function RootLayout({
children, children,
}: Readonly<{ }: Readonly<{
children: React.ReactNode; children: React.ReactNode;
}>) { }>) {
return ( return (
<html lang="ru"> <html lang="ru">
<body className={`${inter.className} flex flex-col min-h-screen`}> <body className={`${inter.className} flex flex-col min-h-screen`}>
<Header /> <Providers>
{children} <Header />
<Footer /> {children}
</body> <Footer />
</html> </Providers>
); </body>
</html>
);
} }

11
src/app/providers.tsx Normal file
View File

@ -0,0 +1,11 @@
"use client";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
export default function Providers({ children }: { children: React.ReactNode }) {
const queryClient = new QueryClient();
return (
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
);
}