Skip to content

Commit

Permalink
fix: add debugging logs, and some more safeguards
Browse files Browse the repository at this point in the history
julrich committed Mar 20, 2022
1 parent 542cf55 commit faef7ca
Showing 4 changed files with 29 additions and 5 deletions.
8 changes: 8 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -19,6 +19,14 @@ const nextConfig = withTM(
target: 'serverless',
generateBuildId: () => "build",
trailingSlash: true,
async rewrites() {
return [
{
source: '/home',
destination: '/',
},
]
},
})
);

6 changes: 5 additions & 1 deletion pages/coding.tsx
Original file line number Diff line number Diff line change
@@ -59,16 +59,20 @@ export async function getStaticProps({ preview = false }: any) {
{ accessToken: accessToken }
)

console.log('repositories index', repositories);

const storyblokApi = getStoryblokApi()
let { data } = await storyblokApi.get(`cdn/stories/coding`, {
version: "published"
});

console.log('story coding', data);

return {
props: {
story: data ? data.story : false,
preview,
repositories: repositories.data.gitHub.user.starredRepositories.edges,
repositories: repositories?.data?.gitHub?.user?.starredRepositories?.edges,
},
revalidate: 3600,
};
12 changes: 9 additions & 3 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -82,9 +82,9 @@ export async function getStaticProps({ preview = false }: any) {
{ accessToken: accessToken }
);

console.log('savedTracksData', savedTracksData);
console.log('savedTracksData index', savedTracksData);

const tracks = await Promise.all(savedTracksData.spotify?.me?.savedTracks.nodes?.map(async (track) => {
const tracks = await Promise.all(savedTracksData?.spotify?.me?.savedTracks.nodes?.map(async (track) => {
const { data: coverData } = await NetlifyGraph.fetchSpotifyArtistCoverQuery(
{
artistId: track.artists[0].id
@@ -104,20 +104,26 @@ export async function getStaticProps({ preview = false }: any) {
}
}));

console.log('tracks index', tracks);

const repositories = await NetlifyGraph.fetchGithubStarredReposQuery(
{},
{ accessToken: accessToken }
)

console.log('repositories index', repositories);

const storyblokApi = getStoryblokApi()
let { data } = await storyblokApi.get(`cdn/stories/home`, {
version: "published"
});

console.log('story index', data);

return {
props: {
tracks,
repositories: repositories.data.gitHub.user.starredRepositories.edges,
repositories: repositories?.data?.gitHub?.user?.starredRepositories?.edges,
story: data ? data.story : false,
preview,
},
8 changes: 7 additions & 1 deletion pages/music.tsx
Original file line number Diff line number Diff line change
@@ -59,7 +59,9 @@ export async function getStaticProps({ preview = false }: any) {
{ accessToken: accessToken }
);

const tracks = await Promise.all(savedTracksData.spotify?.me?.savedTracks.nodes?.map(async (track) => {
console.log('savedTracksData music', savedTracksData);

const tracks = await Promise.all(savedTracksData?.spotify?.me?.savedTracks.nodes?.map(async (track) => {
const { errors: _, data: coverData } = await NetlifyGraph.fetchSpotifyArtistCoverQuery(
{
artistId: track.artists[0].id
@@ -79,10 +81,14 @@ export async function getStaticProps({ preview = false }: any) {
}
}));

console.log('tracks index', tracks);

const storyblokApi = getStoryblokApi()
let { data } = await storyblokApi.get(`cdn/stories/music`, {
version: "published"
});

console.log('story music', data);

return {
props: {

0 comments on commit faef7ca

Please sign in to comment.