From aba4dcb570773cf41012427b11665c9a11daec0f Mon Sep 17 00:00:00 2001 From: Ronja Spiegelberg Date: Sat, 13 Apr 2024 18:06:44 +0200 Subject: [PATCH] player infos --- tank-frontend/src/PlayerInfo.tsx | 24 +++++++++++++++++------- tank-frontend/src/serverCalls.tsx | 2 ++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/tank-frontend/src/PlayerInfo.tsx b/tank-frontend/src/PlayerInfo.tsx index af7501c..d0670ca 100644 --- a/tank-frontend/src/PlayerInfo.tsx +++ b/tank-frontend/src/PlayerInfo.tsx @@ -21,18 +21,28 @@ export default function PlayerInfo({ playerId }: { playerId: string }) {

- name + name:

{player?.name}

-
-

- {JSON.stringify(player)} -

- - +
+

+ kills: +

+

+ {player?.kills} +

+
+
+

+ deaths: +

+

+ {player?.deaths} +

+
; } diff --git a/tank-frontend/src/serverCalls.tsx b/tank-frontend/src/serverCalls.tsx index 6640b47..b6984d3 100644 --- a/tank-frontend/src/serverCalls.tsx +++ b/tank-frontend/src/serverCalls.tsx @@ -1,6 +1,8 @@ export type PlayerResponse = { readonly name: string; readonly id: string; + readonly kills: number; + readonly deaths: number; }; export async function fetchTyped({ url, method }: { url: URL; method: string; }) {