render-main-page-data #8
@ -45,6 +45,6 @@ export type Station = Root<{
|
||||
_propanCopy: boolean;
|
||||
_zaryadnayaStanci: boolean;
|
||||
_miniMarketCop: boolean;
|
||||
_region: Select;
|
||||
_region: Select[];
|
||||
_foto: Image[];
|
||||
}>;
|
||||
|
||||
18
src/app/api-utlities/@types/main.ts
Normal file
18
src/app/api-utlities/@types/main.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import {
|
||||
presentDiscounts,
|
||||
presentJobs,
|
||||
presentPartners,
|
||||
presentStations,
|
||||
} from '../presenters';
|
||||
|
||||
export type Partners = ReturnType<typeof presentPartners>;
|
||||
export type Jobs = ReturnType<typeof presentJobs>;
|
||||
export type Discounts = ReturnType<typeof presentDiscounts>;
|
||||
export type Stations = ReturnType<typeof presentStations>;
|
||||
|
||||
export type MainPageData = {
|
||||
discounts: Discounts;
|
||||
jobs: Jobs;
|
||||
partners: Partners;
|
||||
stations: Stations;
|
||||
};
|
||||
@ -28,7 +28,7 @@ export const presentDiscounts = (discounts: Discount) =>
|
||||
}));
|
||||
|
||||
export const presentStations = (stations: Station) =>
|
||||
stations.records.map((station: any) => ({
|
||||
stations.records.map((station) => ({
|
||||
name: station._name,
|
||||
description: station._opisanie,
|
||||
address: station._adress,
|
||||
|
||||
@ -8,7 +8,14 @@ import { PromotionsSection } from '@/widgets/promotions-section';
|
||||
import { StatsSection } from '@/widgets/stats-section';
|
||||
import { VacanciesSection } from '@/widgets/vacancies-section';
|
||||
|
||||
export default function Home() {
|
||||
import { MainPageData } from './api-utlities/@types/main';
|
||||
|
||||
export default async function Home() {
|
||||
const mainPageData = (await fetch(
|
||||
`${process.env.NEXT_PUBLIC_BASE_URL}/api/pages/main`,
|
||||
{ method: 'GET' },
|
||||
).then((res) => res.json())) as MainPageData;
|
||||
|
||||
return (
|
||||
<main>
|
||||
<HeroSection />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user