Guest User

Untitled

a guest
Jan 22nd, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. import {postsStore} from './posts.store';
  2. import * as ServerApi from '../api';
  3.  
  4. export async function fetchPosts() {
  5. const posts = await ServerApi.fetchPosts();
  6. postsStore.setPosts(posts);
  7. }
  8.  
  9. export async function addPost(post) {
  10. const postToAdd = await ServerApi.addPost(post);
  11. postsStore.addPost(postToAdd);
  12. }
  13.  
  14. export async function deletePost(id) {
  15. await ServerApi.deletePost(id);
  16. postsStore.deletePost(id);
  17. }
Add Comment
Please, Sign In to add comment