From 81543e5307c98df0d44c1cf553bcdfefbfe4ea7f Mon Sep 17 00:00:00 2001
From: mat
Date: Wed, 16 Feb 2022 22:12:59 +0000
Subject: improvements
---
src/routes/player/[player]/[profile].svelte | 62 +++++++++++++++++++++++++----
src/routes/player/[player]/index.svelte | 26 ++++++++----
src/routes/player/index.ts | 2 +-
3 files changed, 73 insertions(+), 17 deletions(-)
(limited to 'src/routes')
diff --git a/src/routes/player/[player]/[profile].svelte b/src/routes/player/[player]/[profile].svelte
index dfb01ab..9c3fb31 100644
--- a/src/routes/player/[player]/[profile].svelte
+++ b/src/routes/player/[player]/[profile].svelte
@@ -5,31 +5,60 @@
export const load: Load = async ({ params, fetch }) => {
const player: string = params.player
const profile: string = params.profile
- const res = await fetch(`${API_URL}player/${player}/${profile}?customization=true`).then(r =>
+ const data = await fetch(`${API_URL}player/${player}/${profile}?customization=true`).then(r =>
r.json()
)
+
+ const constants = await fetch('/constants.json').then(r => r.json())
+
return {
props: {
- data: res,
+ data,
+ constants,
},
}
}
+
+ {@html bodyStyle}
+
+
@@ -43,4 +72,21 @@
{/if}
({data.member.profileName})
+
+
+
+
+
+ {#if data.member.skills.length > 0}
+
+ {/if}
+
diff --git a/src/routes/player/[player]/index.svelte b/src/routes/player/[player]/index.svelte
index 907761d..8704b09 100644
--- a/src/routes/player/[player]/index.svelte
+++ b/src/routes/player/[player]/index.svelte
@@ -4,23 +4,29 @@
export const load: Load = async ({ params, fetch }) => {
const player: string = params.player
- const res = await fetch(`${API_URL}player/${player}?customization=true`).then(r => r.json())
- console.log('res', res)
+ const data = await fetch(`${API_URL}player/${player}?customization=true`).then(r => r.json())
- if (!res.player) {
+ if (!data.player) {
return { fallthrough: true } as unknown
}
- if (res.player.username !== player) {
+ // this should happen instantly
+ // const constants = await fetch('/_constants.json').then(r => r.json())
+
+ // console.log('constants', constants)
+
+ if (data.player.username !== player) {
return {
- redirect: `/player/${res.player.username}`,
+ redirect: `/player/${data.player.username}`,
status: 302,
}
}
return {
- props: { data: res },
+ props: {
+ data,
+ },
}
}
@@ -31,6 +37,7 @@
import Head from '$lib/Head.svelte'
export let data
+ // export let constants
let activeProfile = null
let activeProfileLastSave: number = 0
@@ -53,7 +60,6 @@
{@html bodyStyle}
-