File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 11// map api response into our custom format
22
33export const userMapper = user => ( {
4- ...user ,
4+ id : user . id ,
5+ avatar : user . avatar ,
6+ email : user . email ,
7+ nickname : user . nickname ,
58 firstName : user . first_name ,
69 lastName : user . last_name ,
710} ) ;
811
912export const emptyUser = ( ) => ( {
1013 id : null ,
14+ avatar : null ,
1115 email : '' ,
16+ nickname : '' ,
1217 firstName : '' ,
1318 lastName : '' ,
14- avatar : null ,
15- nickname : '' ,
1619} ) ;
1720
1821export const commentMapper = comment => ( {
19- ...comment ,
22+ id : comment . id ,
23+ body : comment . body ,
2024 authorId : comment . author_id ,
25+ tweetId : comment . tweet_id ,
2126 created : comment . created_at ,
2227 updated : comment . updated_at ,
2328 author : userMapper ( comment . author ) ,
@@ -28,7 +33,8 @@ export const likeMapper = like => ({
2833} ) ;
2934
3035export const tweetMapper = tweet => ( {
31- ...tweet ,
36+ id : tweet . id ,
37+ text : tweet . text ,
3238 imageUrl : tweet . image_url ,
3339 created : tweet . created_at ,
3440 author : userMapper ( tweet . author ) ,
You can’t perform that action at this time.
0 commit comments