render-main-page-data #8
@ -1,7 +1,9 @@
|
||||
import type { Metadata } from 'next';
|
||||
import { Inter } from 'next/font/google';
|
||||
|
||||
import { textControlApi } from '@/shared/language/api/text-control.api';
|
||||
import { Providers } from '@/shared/providers/providers';
|
||||
import { makeStore } from '@/shared/store';
|
||||
import { TextItem } from '@/shared/types/text.types';
|
||||
|
||||
import { Footer } from '@/widgets/footer';
|
||||
@ -22,10 +24,11 @@ export default async function RootLayout({
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
const response = (await fetch(
|
||||
`${process.env.NEXT_PUBLIC_BASE_URL}/api/text`,
|
||||
{ method: 'GET' },
|
||||
).then((res) => res.json())) as TextItem[];
|
||||
const store = makeStore();
|
||||
|
||||
const response = await store.dispatch(
|
||||
textControlApi.endpoints.fetchText.initiate(),
|
||||
);
|
||||
|
||||
return (
|
||||
<html
|
||||
@ -35,7 +38,7 @@ export default async function RootLayout({
|
||||
style={{ scrollBehavior: 'smooth' }}
|
||||
>
|
||||
<body className={`${inter.className} antialiased`}>
|
||||
<Providers textItems={response as TextItem[]}>
|
||||
<Providers textItems={response.data as TextItem[]}>
|
||||
<Header />
|
||||
{children}
|
||||
<Footer />
|
||||
|
||||
@ -12,7 +12,7 @@ export const YandexMap = ({ points }: YandexMapProps) => {
|
||||
return (
|
||||
<YMaps
|
||||
query={{
|
||||
apikey: process.env.YANDEX_MAP_API_KEY,
|
||||
apikey: process.env.NEXT_PUBLIC_YANDEX_MAP_API_KEY,
|
||||
lang: 'ru_RU',
|
||||
}}
|
||||
>
|
||||
|
||||
@ -25,6 +25,7 @@ export const MapSection = ({ stations }: MapSectionProps) => {
|
||||
return (
|
||||
<section id='stations' className='bg-gray-50 px-2 py-8 sm:py-16'>
|
||||
<div className='container mx-auto'>
|
||||
<YandexMap points={points} />
|
||||
<div className='mb-12 flex flex-col items-center justify-center text-center'>
|
||||
<div className='mb-4 inline-flex items-center justify-center rounded-full bg-red-100 p-2'>
|
||||
<MapPin className='h-6 w-6 text-red-600' />
|
||||
@ -40,8 +41,7 @@ export const MapSection = ({ stations }: MapSectionProps) => {
|
||||
className='h-[500px] overflow-hidden rounded-xl border shadow-lg'
|
||||
data-aos='fade-up'
|
||||
>
|
||||
<GasStationMap stations={stations} />
|
||||
{/* <YandexMap points={points} /> */}
|
||||
{/* <GasStationMap stations={stations} /> */}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user