fix: fix text display

This commit is contained in:
BunyodL 2025-04-30 18:13:25 +05:00
parent ec2cd2cf56
commit 6dc26611c3

View File

@ -1,9 +1,7 @@
import type { Metadata } from 'next'; import type { Metadata } from 'next';
import { Inter } from 'next/font/google'; import { Inter } from 'next/font/google';
import { textControlApi } from '@/shared/language/api/text-control.api';
import { Providers } from '@/shared/providers/providers'; import { Providers } from '@/shared/providers/providers';
import { makeStore } from '@/shared/store';
import { TextItem } from '@/shared/types/text.types'; import { TextItem } from '@/shared/types/text.types';
import { Footer } from '@/widgets/footer'; import { Footer } from '@/widgets/footer';
@ -24,11 +22,10 @@ export default async function RootLayout({
}: Readonly<{ }: Readonly<{
children: React.ReactNode; children: React.ReactNode;
}>) { }>) {
const store = makeStore(); const response = (await fetch(
`${process.env.NEXT_PUBLIC_BASE_URL}/api/text`,
const response = await store.dispatch( { method: 'GET' },
textControlApi.endpoints.fetchText.initiate(), ).then((res) => res.json())) as TextItem[];
);
return ( return (
<html <html
@ -38,7 +35,7 @@ export default async function RootLayout({
style={{ scrollBehavior: 'smooth' }} style={{ scrollBehavior: 'smooth' }}
> >
<body className={`${inter.className} antialiased`}> <body className={`${inter.className} antialiased`}>
<Providers textItems={response.data as TextItem[]}> <Providers textItems={response as TextItem[]}>
<Header /> <Header />
{children} {children}
<Footer /> <Footer />