@@ -38,24 +38,38 @@ export async function fetchUnsplashStats(
3838 fetch ( `https://api.unsplash.com/users/${ username } /statistics?client_id=${ accessKey } ` ) ,
3939 fetch ( `https://api.unsplash.com/users/${ username } ?client_id=${ accessKey } ` )
4040 ] ) ;
41+
42+ const [ statisticsResponseD , profileResponseD ] = await Promise . all ( [
43+ fetch ( `https://api.unsplash.com/users/danielaasada/statistics?client_id=${ accessKey } ` ) ,
44+ fetch ( `https://api.unsplash.com/users/danielaasada?client_id=${ accessKey } ` )
45+ ] ) ;
4146
4247 if ( ! statisticsResponse . ok || ! profileResponse . ok ) {
4348 throw new Error ( `Failed to fetch Unsplash data` ) ;
4449 }
50+
51+ if ( ! statisticsResponseD . ok || ! profileResponseD . ok ) {
52+ throw new Error ( `Failed to fetch Unsplash data` ) ;
53+ }
4554
4655 const [ statisticsData , profileData ] = await Promise . all ( [
4756 statisticsResponse . json ( ) ,
4857 profileResponse . json ( )
4958 ] ) ;
50-
59+
60+ const [ statisticsDataD , profileDataD ] = await Promise . all ( [
61+ statisticsResponseD . json ( ) ,
62+ profileResponseD . json ( )
63+ ] ) ;
64+
5165 return {
5266 username : profileData . username ,
53- totalPhotos : profileData . total_photos || 0 ,
54- totalViews : statisticsData . views ?. total || 0 ,
55- totalDownloads : statisticsData . downloads ?. total || 0 ,
56- totalLikes : profileData . total_likes || 0 ,
57- followers : profileData . followers_count || 0 ,
58- following : profileData . following_count || 0 ,
67+ totalPhotos : profileData . total_photos + profileDataD . total_photos || 0 ,
68+ totalViews : statisticsData . views ?. total + statisticsDataD . views ?. total || 0 ,
69+ totalDownloads : statisticsData . downloads ?. total + statisticsDataD . downloads ?. total || 0 ,
70+ totalLikes : profileData . total_likes + profileDataD . total_likes || 0 ,
71+ followers : profileData . followers_count + profileDataD . followers_count || 0 ,
72+ following : profileData . following_count + profileDataD . following_count || 0 ,
5973 profileImage : profileData . profile_image ?. large || '' ,
6074 bio : profileData . bio || '' ,
6175 location : profileData . location || '' ,
0 commit comments