diff --git a/src/client/src/TournamentTeams.js b/src/client/src/TournamentTeams.js index 83a87cb..fe914bb 100644 --- a/src/client/src/TournamentTeams.js +++ b/src/client/src/TournamentTeams.js @@ -2,17 +2,13 @@ import * as React from "react"; import { BrowserRouter as Router, Link, Route, Routes, useParams } from "react-router-dom"; import Appbar from "./components/AsuraBar"; import TournamentBar from "./components/TournamentBar"; +import ErrorSnackbar from "./components/ErrorSnackbar"; import LoginPage from "./LoginPage"; import { Button, TextField, Stack, MenuItem, Box, InputLabel, Select, Container, TableContainer, Table, TableBody, TableHead, TableCell, TableRow, Paper, Typography} from "@mui/material"; import AddCircleIcon from '@mui/icons-material/AddCircle'; import DeleteIcon from '@mui/icons-material/Delete'; import EditIcon from '@mui/icons-material/Edit'; -function showError(error) { - alert("Something went wrong. \n" + error); - console.error(error); -} - function TeamCreator(props) { function postCreate() { let teamName = document.getElementById("teamNameInput").value; @@ -183,6 +179,8 @@ function TeamEditor(props) { ) } +let showError = (message) => {}; + export default function TournamentTeams(props) { const [teams, setTeams] = React.useState([]); const [selectedTeamId, setSelectedTeamId] = React.useState(-1); @@ -203,6 +201,14 @@ export default function TournamentTeams(props) { React.useEffect(() => { getTeams() }, []); + + const [openError, setOpenError] = React.useState(false); + const [errorMessage, setErrorMessage] = React.useState(""); + showError = (message) => { + setOpenError(false); + setErrorMessage(message); + setOpenError(true); + } if (!props.user.isLoggedIn) { return ; } @@ -215,6 +221,7 @@ export default function TournamentTeams(props) { + ); } \ No newline at end of file