import { Page } from "@/data/page";
import { PageDTO, pageDtoTransformer } from "./dto/page"
import { axios } from "@/api/index";
import { prepare } from "@/routing";

const STATIC_PAGE_ENDPOINT = "/staticPage/:slug"

export async function get(slug: string): Promise<Page> {
    const response = await axios.get<PageDTO>(prepare(STATIC_PAGE_ENDPOINT, { slug }))
    const page = response.data;

    return pageDtoTransformer.transform(page);
}
