17 lines
465 B
TypeScript
17 lines
465 B
TypeScript
import useSWR from "swr"
|
|
import PostList from "../post-list"
|
|
import Cookies from "js-cookie"
|
|
|
|
const fetcher = (url: string) => fetch(url, {
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'Authorization': `Bearer ${Cookies.get("drift-token")}`
|
|
},
|
|
}).then(r => r.json())
|
|
|
|
const MyPosts = () => {
|
|
const { data, error } = useSWR('/server-api/users/mine', fetcher)
|
|
return <PostList posts={data} error={error} />
|
|
}
|
|
|
|
export default MyPosts
|