diff --git a/src/lib/components/Game.svelte b/src/lib/components/Game.svelte
index 8644d8f..cb76743 100644
--- a/src/lib/components/Game.svelte
+++ b/src/lib/components/Game.svelte
@@ -1,12 +1,12 @@
@@ -44,7 +58,7 @@
{game.name}
- {game.playtime} minutes played
+ {hours > 0 ? `${hours}h ` : ''}{minutes}m played
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 513d1b0..4d43a1a 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -11,7 +11,7 @@
export let data: PageData
- $: ({ albums, steamGames, psnGames, error } = data)
+ $: ({ albums, games, error } = data)
@@ -72,22 +72,10 @@
- {#if steamGames && steamGames.length > 0}
+ {#if games && games.length > 0}
- {#each steamGames.slice(0, 3) as game}
-
- {/each}
-
- {:else}
- Loading games...
- {/if}
-
-
-
- {#if psnGames && psnGames.length > 0}
-
- {#each psnGames.slice(0, 3) as game}
-
+ {#each games.slice(0, 3) as game}
+
{/each}
{:else}
diff --git a/src/routes/+page.ts b/src/routes/+page.ts
index 1014991..12f1949 100644
--- a/src/routes/+page.ts
+++ b/src/routes/+page.ts
@@ -1,6 +1,5 @@
import type { PageLoad } from './$types'
import type { Album } from '$lib/types/lastfm'
-import type { RecentlyPlayedGame } from 'psn-api'
export const load: PageLoad = async ({ fetch }) => {
try {
@@ -10,8 +9,18 @@ export const load: PageLoad = async ({ fetch }) => {
fetchRecentPSNGames(fetch)
])
+ const response = await fetch('/api/giantbomb', {
+ method: 'POST',
+ body: JSON.stringify({ games: psnGames }),
+ headers: {
+ 'Content-Type': 'application/json'
+ }
+ })
+
+ const games = await response.json()
return {
albums,
+ games: games,
steamGames: steamGames,
psnGames: psnGames
}