File tree 5 files changed +24
-13
lines changed
5 files changed +24
-13
lines changed Original file line number Diff line number Diff line change 1
- import SpotifyLogo from '../Spotify/SpotifySvg' ;
2
1
import Line from '../Line' ;
3
2
import { LinkComponent } from '../Typography' ;
4
- import { useEffect } from 'react' ;
5
3
import NowPlaying from '../Spotify/NowPlaying' ;
6
4
7
5
export default function Footer ( ) {
8
- useEffect ( ( ) => {
9
- fetch ( '/api/fetchCurrentPlayingSong' )
10
- . then ( ( response ) => response . json ( ) )
11
- . then ( ( response ) => {
12
- console . log ( response ) ;
13
- } ) ;
14
- } , [ ] ) ;
15
-
16
6
return (
17
7
< footer className = "Footer mt-12" >
18
8
< Line />
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ const apiMap = {
2
2
SPOTIFY_GET_CURRENT_PLAYING_TRACK :
3
3
'https://api.spotify.com/v1/me/player/currently-playing' ,
4
4
SPOTIFY_ACCESS_TOKEN : 'https://accounts.spotify.com/api/token' ,
5
+ SPOTIFY_TOP_TRACKS_ENDPOINT : 'https://api.spotify.com/v1/me/top/tracks' ,
5
6
} ;
6
7
7
8
export default apiMap ;
Original file line number Diff line number Diff line change @@ -17,3 +17,13 @@ export default function AboutPage() {
17
17
</ >
18
18
) ;
19
19
}
20
+
21
+ // export async function getServerSideProps() {
22
+ // const res = await getTopTracks();
23
+ // const tracks = await res.json();
24
+ // return {
25
+ // props: {
26
+ // tracks: tracks.items,
27
+ // },
28
+ // };
29
+ // }
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import SeoManager from '../../components/SeoManager/SeoManager';
7
7
import { getAllPosts , getPostBySlug } from '../../utils/index' ;
8
8
import { blogFrontMatter } from '../../types/blogfrontMatter' ;
9
9
10
- function BlogPosts ( props : { source : any , frontMatter : blogFrontMatter } ) {
10
+ function BlogPosts ( props : { source : any ; frontMatter : blogFrontMatter } ) {
11
11
return (
12
12
< >
13
13
< SeoManager
@@ -29,8 +29,8 @@ export function getStaticPaths() {
29
29
} ) ) ;
30
30
return {
31
31
paths,
32
- fallback : false
33
- }
32
+ fallback : false ,
33
+ } ;
34
34
}
35
35
36
36
export async function getStaticProps ( pageData ) {
Original file line number Diff line number Diff line change @@ -33,3 +33,13 @@ export const getNowPlaying = async () => {
33
33
} ,
34
34
} ) ;
35
35
} ;
36
+
37
+ export const getTopTracks = async ( ) => {
38
+ const { access_token } = await getAccessToken ( ) ;
39
+
40
+ return fetch ( apiMap . SPOTIFY_TOP_TRACKS_ENDPOINT , {
41
+ headers : {
42
+ Authorization : `Bearer ${ access_token } ` ,
43
+ } ,
44
+ } ) ;
45
+ } ;
You can’t perform that action at this time.
0 commit comments