import { apiGet } from '@/lib/api' import type { WikiPage } from '@/types' export const fetchWikiPages = async ( { title }: { title?: string }, ): Promise => await apiGet ('/wiki', { params: { title } }) export const fetchWikiPage = async ( id: string, { version }: { version?: string }, ): Promise => await apiGet (`/wiki/${ id }`, { params: version ? { version } : { } }) export const fetchWikiPageByTitle = async ( title: string, { version }: { version?: string }, ): Promise => { try { return await apiGet (`/wiki/title/${ encodeURIComponent (title) }`, { params: { version } }) } catch { return null } }