Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushithamsilva committed Jan 25, 2024
2 parents bc83be6 + a3c6106 commit 00dbd59
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion code/client/impax/src/services/httpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const getPlayers = async () => {
},
});
const playersData: Players = await playersResponse.json();

console.log(playersData);
updatePlayersDetails(playersData);
} catch (error) {
console.log(error);
Expand Down
11 changes: 7 additions & 4 deletions code/client/impax/src/states/appState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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: (
Expand Down Expand Up @@ -105,7 +107,7 @@ export const useAppState = create<AppState>()((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();
Expand Down Expand Up @@ -156,15 +158,16 @@ export const useAppState = create<AppState>()((set) => ({
addPlayer: (
jersey_number: number,
player_name: string,
player_email: string
player_email: string,
verification:Verification
) =>
set((prevState) => {
const playerDetails = {
...prevState.playerDetails,
[jersey_number]: {
name: player_name,
email: player_email,
verification: "pending" as Verification,
verification: verification,
},
};

Expand Down

0 comments on commit 00dbd59

Please sign in to comment.