efbdb82535
- Implemented CmsContext and CmsProvider for global state management of CMS data. - Created a custom hook `useGetCms` to fetch CMS data using React Query. - Defined TypeScript interfaces for CMS response and its related data structures. - Added error handling for data fetching in both the service and context.
73 lines
1.2 KiB
TypeScript
73 lines
1.2 KiB
TypeScript
export interface CmsResponse {
|
|
success: boolean;
|
|
message: string;
|
|
data: CmsData;
|
|
}
|
|
|
|
export interface CmsData {
|
|
id: string;
|
|
key: string;
|
|
hero: CmsHero;
|
|
chart: CmsChart;
|
|
features: CmsSectionWithCards;
|
|
challenges: CmsSectionWithCards;
|
|
advantages: CmsSectionWithCards;
|
|
contact: CmsContact;
|
|
footer: CmsFooter;
|
|
created_at: number;
|
|
updated_at: number;
|
|
}
|
|
|
|
export interface CmsHero {
|
|
Title: string;
|
|
Description: string;
|
|
ButtonText: string;
|
|
ButtonLink: string;
|
|
GifFile: string;
|
|
}
|
|
|
|
export interface CmsChart {
|
|
title: string;
|
|
missedAmount: string;
|
|
data: CmsChartDataItem[];
|
|
}
|
|
|
|
export interface CmsChartDataItem {
|
|
key: string;
|
|
value: number;
|
|
}
|
|
|
|
export interface CmsSectionWithCards {
|
|
Title: string;
|
|
Description: string;
|
|
Cards: CmsCard[];
|
|
}
|
|
|
|
export interface CmsCard {
|
|
Icon: string;
|
|
Title: string;
|
|
Description: string;
|
|
}
|
|
|
|
export interface CmsContact {
|
|
Title: string;
|
|
Description: string;
|
|
SubmitButtonText: string;
|
|
Fields: CmsContactField[];
|
|
}
|
|
|
|
export interface CmsContactField {
|
|
Name: string;
|
|
Label: string;
|
|
Placeholder: string;
|
|
Required: boolean;
|
|
}
|
|
|
|
export interface CmsFooter {
|
|
Email: string;
|
|
Phone: string;
|
|
Location: string;
|
|
Tagline: string;
|
|
Copyright: string;
|
|
}
|