import React, { FC, useEffect, useState } from 'react' import { axiosServer } from '../../utils/axios' import { Loading } from '../../components/Loading' import { BlogSummary } from './BlogSummary' type Props = Record interface Blog { id: string path: string title: string summary: string createdDate: string category?: string tags?: string url?: string date?: string } // @ts-ignore export const BlogList: FC = () => { const [blogs, setBlogs] = useState([]) const [isLoading, setIsLoading] = useState(true) useEffect(() => { axiosServer .get('/api/posts.json') .then(({ data }) => setBlogs(data)) .catch(() => {}) .finally(() => setIsLoading(false)) }, []) if (isLoading) { return } return blogs.map(({ id, path, title, summary, createdDate }) => ( )) }