Артем Леванов
first commit
41a71fd
raw
history blame contribute delete
475 Bytes
import { $api } from '@/shared/api/axiosInstance';
import { PostType } from '@/entities/Post';
import { PostFormType } from '../ui/PostForm/PostForm';
type CreatePostProps = {
user_id: number;
} & PostFormType;
type CreatePostResponse = {
status: number;
message: string;
post: PostType;
};
export const createPost = async (props: CreatePostProps) => {
const { data } = await $api.post<CreatePostResponse>(`/posts/create`, props);
return data;
};