32 lines
873 B
TypeScript
32 lines
873 B
TypeScript
import { fetchAPI } from "./api-client";
|
|
import type { StreamFieldBlock } from "@/types/wagtail";
|
|
|
|
export interface IndustryDemo {
|
|
slug: string;
|
|
label: string;
|
|
company: string;
|
|
description: string;
|
|
url: string;
|
|
}
|
|
|
|
export interface DemoPage {
|
|
industry: string;
|
|
label: string;
|
|
company: string;
|
|
title: string;
|
|
blocks: StreamFieldBlock[];
|
|
html: string;
|
|
intro: string;
|
|
children: { title: string; url: string }[];
|
|
navigation: { title: string; url: string }[];
|
|
}
|
|
|
|
export function getIndustryDemos() {
|
|
return fetchAPI<{ items: IndustryDemo[] }>("/api/v1/custom/core/demos/", { revalidate: 0 });
|
|
}
|
|
|
|
export function getDemoPage(industry: string, segments: string[] = []) {
|
|
const path = encodeURIComponent(segments.join("/"));
|
|
return fetchAPI<DemoPage>(`/api/v1/custom/core/demos/${encodeURIComponent(industry)}/?path=${path}`, { revalidate: 0 });
|
|
}
|