File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -29,8 +29,8 @@ export default {
2929
3030 async created () {
3131 try {
32- this .tweets = await this .fetchTweetsByUserId ({
33- userId: this .$route .params .id ,
32+ this .tweets = await this .fetchTweetsByUserId ({
33+ userId: this .$route .params .id ,
3434 params: {
3535 page: 1
3636 }
@@ -67,7 +67,7 @@ export default {
6767 }
6868 } catch (error) {
6969 this .showErrorMessage (error .message );
70- $state .loaded ();
70+ $state .complete ();
7171 }
7272 },
7373 },
Original file line number Diff line number Diff line change @@ -9,16 +9,18 @@ import api from '@/api/Api';
99import { tweetMapper } from '@/services/Normalizer' ;
1010
1111export default {
12- async fetchTweets ( { commit } , params ) {
12+ async fetchTweets ( { commit } , { page } ) {
1313 commit ( SET_LOADING , true , { root : true } ) ;
1414
1515 try {
16- const data = await api . get ( '/tweets' , params ) ;
16+ const tweets = await api . get ( '/tweets' , { page } ) ;
1717
18- commit ( SET_TWEETS , data ) ;
18+ commit ( SET_TWEETS , tweets ) ;
1919 commit ( SET_LOADING , false , { root : true } ) ;
2020
21- return Promise . resolve ( data ) ;
21+ return Promise . resolve (
22+ tweets . map ( tweetMapper )
23+ ) ;
2224 } catch ( error ) {
2325 commit ( SET_LOADING , false , { root : true } ) ;
2426
You can’t perform that action at this time.
0 commit comments