File size: 661 Bytes
f5071ca |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
export const fetchPost = postId => $.ajax({
url: `api/posts/${postId}`,
method: 'GET'
});
export const fetchWallPosts = userId => $.ajax({
url: `api/users/${userId}/posts`,
method: 'GET'
});
export const fetchFeedPosts = userId => $.ajax({
url: `api/users/${userId}/feed`,
method: 'GET'
});
export const createPost = post => $.ajax({
url: 'api/posts',
method: 'POST',
data: post,
contentType: false,
processData: false
});
export const updatePost = post => $.ajax({
url: `api/posts/${post.id}`,
method: 'PATCH',
data: { post }
});
export const deletePost = postId => $.ajax({
url: `api/posts/${postId}`,
method: 'DELETE'
}); |