File size: 814 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
export const createPost = formdata =>
  $.ajax({
    method: 'POST',
    url: 'api/posts',
    data: formdata,
    processData: false,
    contentType: false,
  });

export const updatePost = post =>
  $.ajax({
    method: 'PATCH',
    url: `api/posts/${post.id}`,
    data: { post }
  });

export const deletePost = id =>
  $.ajax({
    method: 'DELETE',
    url: `api/posts/${id}`
  });

export const fetchWallPosts = id =>
  $.ajax({
    method: 'GET',
    url: `api/users/${id}/wall`
  });

export const fetchNewsFeed = () =>
  $.ajax({
    method: 'GET',
    url: `api/users/feed`
  });


  export const fetchPost = id => (
    $.ajax({
      method: 'GET',
      url: `api/posts/${id}`
    })
  );

  export const fetchAllPosts = () => (
    $.ajax({
      method: 'GET',
      url: `api/posts/`
    })
  );