File size: 344 Bytes
41a71fd
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
import { PostType } from '../model/types/post';
import { $api } from '@/shared/api/axiosInstance';

type FetchPostByIdProps = number;
type FetchPostByIdResponse = PostType;

export const fetchPostById = async (postId: FetchPostByIdProps) => {
    const { data } = await $api.get<FetchPostByIdResponse>(`/posts/${postId}`);

    return data;
};