2022-03-06 19:46:59 -05:00
|
|
|
import useSWR from "swr"
|
|
|
|
import PostList from "../post-list"
|
|
|
|
|
|
|
|
const fetcher = (url: string) => fetch(url, {
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
'Authorization': `Bearer ${localStorage.getItem("drift-token")}`
|
|
|
|
},
|
|
|
|
}).then(r => r.json())
|
|
|
|
|
|
|
|
const MyPosts = () => {
|
|
|
|
const { data, error } = useSWR('/api/users/mine', fetcher)
|
|
|
|
return <PostList posts={data} error={error} />
|
|
|
|
}
|
|
|
|
|
2022-03-09 04:33:22 -05:00
|
|
|
export default MyPosts
|