27 lines
447 B
TypeScript
27 lines
447 B
TypeScript
import { useApi } from '@/composables/useApi'
|
|
|
|
export interface ArticleImage {
|
|
id: number
|
|
url: string
|
|
}
|
|
|
|
export interface Article {
|
|
id: number
|
|
title: string
|
|
body: string
|
|
images: ArticleImage[]
|
|
is_online: boolean
|
|
created_at: string
|
|
updated_at: string
|
|
}
|
|
|
|
export function useArticles() {
|
|
const { request } = useApi()
|
|
|
|
function listArticles(): Promise<Article[]> {
|
|
return request<Article[]>('/v1/article/')
|
|
}
|
|
|
|
return { listArticles }
|
|
}
|