Files
KLC-Website-Frontend/src/redux/services/aboutUsApi.ts
priyanshuvish 6d31c3b96f all changes
2026-04-22 13:14:23 +05:30

129 lines
2.5 KiB
TypeScript

import { createApi } from "@reduxjs/toolkit/query/react";
import baseQueryWithReauth from "./baseQuery";
export interface HeroSection {
id: string;
background_image_url: string;
background_image_alt_text: string;
headline: string;
subtext: string;
cta_text: string;
cta_destination: string;
}
export interface HowWeWorkItem {
id: string;
title: string;
description: string;
image_url: string;
display_order: number;
}
export interface Testimonial {
id: string;
profile_xid: string;
name: string;
designation: string;
content: string;
video_url: string;
display_order: number;
testimonial_page_type: string;
}
export interface StatItem {
id: string;
number: number;
suffix: string;
label: string;
display_order: number;
}
export interface TeamMember {
id: string;
display_order: number;
name_role: string;
photo_url: string;
alt_text: string;
bio: string;
}
export interface CtaData {
id: string;
background_image_url: string;
text: string;
cta_text: string;
cta_destination: string;
description: string;
landing_page_type: string;
service_type: string | null;
}
export interface AboutUsData {
hero_section: HeroSection;
our_promise_title: string;
how_we_work_title: string;
who_we_are_title: string;
our_team_title: string;
our_team_description: string;
how_we_work: HowWeWorkItem[];
stat_section: StatItem[];
our_team: TeamMember[];
methodology: Methodology;
philosophy: Philosophy;
testimonials: Testimonial[];
cta_section: CtaData;
}
export interface Methodology {
title: string;
subtitle: string;
phases: Phase[];
}
export interface Phase {
id?: string;
phase_number: number;
phase_label: string;
title: string;
description: string;
bullet_title: string;
bullets: string[];
display_order: number;
}
export interface Philosophy {
title: string;
description: string;
points: string[];
}
export interface AboutUsResponse {
success: boolean;
status: number;
message: string;
data: AboutUsData;
}
export const aboutUsApi = createApi({
reducerPath: "aboutUsApi",
baseQuery: baseQueryWithReauth,
tagTypes: ["AboutUs"],
endpoints: (builder) => ({
// ✅ GET About Us
getAboutUs: builder.query<AboutUsData, void>({
query: () => ({
url: "/guest/about-us",
method: "GET",
}),
// 🔥 extract only useful data
transformResponse: (response: AboutUsResponse) => response.data,
providesTags: ["AboutUs"],
}),
}),
});
export const {
useGetAboutUsQuery,
} = aboutUsApi;