From 1d4ac2b8197f6ca7c6e694a6054b1397fefd4123 Mon Sep 17 00:00:00 2001 From: Mansitha Date: Fri, 26 Jan 2024 02:38:27 +0530 Subject: [PATCH 1/3] Add isVerified parameter to addPlayer function --- .../src/components/PlayerManagement/PlayerManagement.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/client/impax/src/components/PlayerManagement/PlayerManagement.tsx b/code/client/impax/src/components/PlayerManagement/PlayerManagement.tsx index 1b8e4740..f049141b 100644 --- a/code/client/impax/src/components/PlayerManagement/PlayerManagement.tsx +++ b/code/client/impax/src/components/PlayerManagement/PlayerManagement.tsx @@ -168,7 +168,12 @@ const PlayerManagement = () => { const responseData = await response.json(); if (response.ok) { console.log("response OK", responseData); - addPlayer(data.jersey_number, data.name, data.email); + addPlayer( + data.jersey_number, + data.name, + data.email, + responseData.isVerified + ); } reset(); From e84c7adb9101bf8d873d7b652264c7ae58d41467 Mon Sep 17 00:00:00 2001 From: Mansitha Date: Fri, 26 Jan 2024 02:38:33 +0530 Subject: [PATCH 2/3] Add console.log to display playersData --- code/client/impax/src/services/httpClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/client/impax/src/services/httpClient.ts b/code/client/impax/src/services/httpClient.ts index ec310be7..2b5a3079 100644 --- a/code/client/impax/src/services/httpClient.ts +++ b/code/client/impax/src/services/httpClient.ts @@ -47,7 +47,7 @@ export const getPlayers = async () => { }, }); const playersData: Players = await playersResponse.json(); - + console.log(playersData); updatePlayersDetails(playersData); } catch (error) { console.log(error); From a3c6106ae610318e1fedb1fd3b3ec8cfb6d5bc28 Mon Sep 17 00:00:00 2001 From: Mansitha Date: Fri, 26 Jan 2024 02:38:39 +0530 Subject: [PATCH 3/3] Add Verification component to appState --- code/client/impax/src/states/appState.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/code/client/impax/src/states/appState.ts b/code/client/impax/src/states/appState.ts index 55fa688b..b40d5989 100644 --- a/code/client/impax/src/states/appState.ts +++ b/code/client/impax/src/states/appState.ts @@ -15,6 +15,7 @@ import { import { players } from "../data/players"; import { deleteByValue } from "../utils/utils"; import MqttClient from "../services/mqttClient"; +import { Verification, Verification } from "../components/PlayerManagement/PlayersTable/Verification/Verification"; interface AppState { activePage: activePage; @@ -42,7 +43,8 @@ interface AppState { addPlayer: ( jersey_number: number, player_name: string, - player_email: string + player_email: string, + Verification:Verification ) => void; removePlayer: (player_id: number) => void; editPlayer: ( @@ -105,7 +107,7 @@ export const useAppState = create()((set) => ({ playersImpactHistory: {} as PlayerImpactHistory, //TODO: Clashing of players with other dashbaords - playerDetails: players, + playerDetails: {} as Players, setPlayerDetails: (players: Players) => { set({ playerDetails: players }); const timestamp = new Date().getTime(); @@ -156,7 +158,8 @@ export const useAppState = create()((set) => ({ addPlayer: ( jersey_number: number, player_name: string, - player_email: string + player_email: string, + verification:Verification ) => set((prevState) => { const playerDetails = { @@ -164,7 +167,7 @@ export const useAppState = create()((set) => ({ [jersey_number]: { name: player_name, email: player_email, - verification: "pending" as Verification, + verification: verification, }, };