@@ -11,28 +11,29 @@ import api from '@/api/Api';
1111import { tweetMapper } from '@/services/Normalizer' ;
1212
1313export default {
14- async fetchTweets ( { commit } ) {
14+ async fetchTweets ( { commit } , { page } ) {
1515 commit ( SET_LOADING , true , { root : true } ) ;
1616
1717 try {
18- const data = await api . get ( '/tweets' ) ;
18+ const tweets = await api . get ( '/tweets' , { page } ) ;
1919
20- commit ( SET_TWEETS , data ) ;
20+ commit ( SET_TWEETS , tweets ) ;
2121 commit ( SET_LOADING , false , { root : true } ) ;
2222
23- return Promise . resolve ( ) ;
23+ return Promise . resolve (
24+ tweets . map ( tweetMapper )
25+ ) ;
2426 } catch ( error ) {
2527 commit ( SET_LOADING , false , { root : true } ) ;
2628
2729 return Promise . reject ( error ) ;
2830 }
2931 } ,
3032
31- async fetchTweetsByUserId ( { commit } , userId ) {
33+ async fetchTweetsByUserId ( { commit } , { userId, params } ) {
3234 commit ( SET_LOADING , true , { root : true } ) ;
33-
3435 try {
35- const tweets = await api . get ( `/users/${ userId } /tweets` ) ;
36+ const tweets = await api . get ( `/users/${ userId } /tweets` , params ) ;
3637
3738 commit ( SET_LOADING , false , { root : true } ) ;
3839
0 commit comments