rework session work
This commit is contained in:
+14
-20
@@ -6,10 +6,11 @@ import { getQueryClient } from '@/app/providers/getQueryClient';
|
||||
import { HydrationBoundary, dehydrate } from '@tanstack/react-query';
|
||||
import { prefetchLayoutQueries } from '@/app/lib/prefetch-queries';
|
||||
import { routing } from '@/i18n/routing';
|
||||
import AdminNavLinks from '@/app/ui/navigation/admin-nav-links'
|
||||
import AdminHeaderPanel from '@/app/ui/admin-header-panel';
|
||||
import AdminLayoutWrapper from '@/app/components/admin-layout-wrapper';
|
||||
|
||||
// @ts-expect-error - CSS modules types not defined
|
||||
import "../styles/globals.css";
|
||||
// @ts-expect-error - CSS modules types not defined
|
||||
import "../styles/global-styles.scss"
|
||||
|
||||
export const metadata: Metadata = {
|
||||
@@ -17,7 +18,7 @@ export const metadata: Metadata = {
|
||||
description: "Admin panel no copy",
|
||||
};
|
||||
|
||||
export function generateStaticParams() {
|
||||
export async function generateStaticParams() {
|
||||
return routing.locales.map((locale: any) => ({ locale }));
|
||||
}
|
||||
|
||||
@@ -29,6 +30,7 @@ export default async function RootLayout({
|
||||
params: Promise<{ locale: string }>;
|
||||
}>) {
|
||||
const { locale } = await params;
|
||||
|
||||
if (!hasLocale(routing.locales, locale)) {
|
||||
notFound();
|
||||
}
|
||||
@@ -38,21 +40,13 @@ export default async function RootLayout({
|
||||
|
||||
return (
|
||||
<html lang="en">
|
||||
<NextIntlClientProvider>
|
||||
<Providers>
|
||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||
<body className="admin-panel">
|
||||
<AdminNavLinks />
|
||||
<div className="admin-main">
|
||||
<AdminHeaderPanel />
|
||||
<main className="main-containter">
|
||||
{children}
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
</HydrationBoundary>
|
||||
</Providers>
|
||||
</NextIntlClientProvider>
|
||||
</html >
|
||||
<body>
|
||||
<NextIntlClientProvider>
|
||||
<Providers>
|
||||
{children}
|
||||
</Providers>
|
||||
</NextIntlClientProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import { hasLocale } from 'next-intl';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { getQueryClient } from '@/app/providers/getQueryClient';
|
||||
import { prefetchLayoutQueries } from '@/app/lib/prefetch-queries';
|
||||
import { routing } from '@/i18n/routing';
|
||||
|
||||
export default async function RootLayout({
|
||||
children,
|
||||
params
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
params: Promise<{ locale: string }>;
|
||||
}>) {
|
||||
const { locale } = await params;
|
||||
if (!hasLocale(routing.locales, locale)) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
const queryClient = getQueryClient();
|
||||
await prefetchLayoutQueries(queryClient);
|
||||
|
||||
return (
|
||||
<div className="">
|
||||
<main className="main-containter">
|
||||
{children}
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import LoginForm from '@/app/ui/forms/login-form';
|
||||
import Link from 'next/link';
|
||||
|
||||
export default function Page() {
|
||||
return (
|
||||
<div>
|
||||
<LoginForm />
|
||||
|
||||
<br />
|
||||
|
||||
<Link
|
||||
href={'/pages/'}
|
||||
>
|
||||
link
|
||||
</Link>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import type { Metadata } from "next";
|
||||
import Providers from '@/app/providers/getQueryServer'
|
||||
import { NextIntlClientProvider, hasLocale } from 'next-intl';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { getQueryClient } from '@/app/providers/getQueryClient';
|
||||
import { HydrationBoundary, dehydrate } from '@tanstack/react-query';
|
||||
import { prefetchLayoutQueries } from '@/app/lib/prefetch-queries';
|
||||
import { routing } from '@/i18n/routing';
|
||||
import AdminLayoutWrapper from '@/app/components/admin-layout-wrapper';
|
||||
|
||||
// @ts-expect-error - CSS modules types not defined
|
||||
import "../../styles/globals.css";
|
||||
// @ts-expect-error - CSS modules types not defined
|
||||
import "../../styles/global-styles.scss"
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Admin panel no copy",
|
||||
description: "Admin panel no copy",
|
||||
};
|
||||
|
||||
export async function generateStaticParams() {
|
||||
return routing.locales.map((locale: any) => ({ locale }));
|
||||
}
|
||||
|
||||
export default async function RootLayout({
|
||||
children,
|
||||
params
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
params: Promise<{ locale: string }>;
|
||||
}>) {
|
||||
const { locale } = await params;
|
||||
|
||||
if (!hasLocale(routing.locales, locale)) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
const queryClient = getQueryClient();
|
||||
await prefetchLayoutQueries(queryClient);
|
||||
|
||||
return (
|
||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||
<div className="admin-panel">
|
||||
<AdminLayoutWrapper>
|
||||
{children}
|
||||
</AdminLayoutWrapper>
|
||||
</div>
|
||||
</HydrationBoundary>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user