diff --git a/code/client/impax/src/components/PlayerManagement/PlayerManagement.tsx b/code/client/impax/src/components/PlayerManagement/PlayerManagement.tsx index e1aad2e0..7e3b9649 100644 --- a/code/client/impax/src/components/PlayerManagement/PlayerManagement.tsx +++ b/code/client/impax/src/components/PlayerManagement/PlayerManagement.tsx @@ -173,7 +173,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(); 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); 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, }, };