Skip to content

Commit

Permalink
fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aaravbajaj012 committed Jan 27, 2024
1 parent 72d09d4 commit 6cc3d0d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 34 deletions.
4 changes: 3 additions & 1 deletion src/pages/api/admin/modify-permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ export default async function handler(
try {
const response = await client.send(new UpdateCommand(params));
if (response)
return res.status(200).send({ message: 'Permissions updated successfully!' });
return res
.status(200)
.send({ message: 'Permissions updated successfully!' });

return res.status(400).send({ message: 'Error updating permissions!' });
} catch (error) {
Expand Down
19 changes: 8 additions & 11 deletions src/pages/api/user/match-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,19 @@ export default async function handler(
.send({ message: 'Error creating match request', error: 'No player' });
}


let matchRequestData = {};

if(map) {
if (map) {
matchRequestData = {
players: [{ username: player }, { username: opp }],
map: map,
map,
shuffler: 'random',
}
};
} else {
matchRequestData = {
players: [{ username: player }, { username: opp }],
shuffler: 'random',
}
};
}

try {
Expand All @@ -46,11 +45,9 @@ export default async function handler(
return res.status(200).send({ message: 'Success', data: response.data });
} catch (err) {
console.log(err);
return res
.status(500)
.send({
message: 'Error fetching data',
error: 'Internal Error, please try again later',
});
return res.status(500).send({
message: 'Error fetching data',
error: 'Internal Error, please try again later',
});
}
}
39 changes: 20 additions & 19 deletions src/pages/user/scrimmages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const TeamInfo: React.FC<{
.post('/api/user/match-request', {
player: playerTeam,
opp: oppTeam.name,
map: map,
map,
})
.then((response: AxiosResponse) => {
if (response.status === 200) {
Expand All @@ -145,8 +145,9 @@ const TeamInfo: React.FC<{
<Card className='mb-3'>
<Card.Body>
<Card.Title>
<small>Map: {map ? map : "Random"}</small> {/* Replace "map" with the actual property in your oppTeam object */}
<br/>
<small>Map: {map || 'Random'}</small>{' '}
{/* Replace "map" with the actual property in your oppTeam object */}
<br />
<small>Opponent: {oppTeam.name}</small>
</Card.Title>
<Card.Subtitle className='mb-2 text-muted' />
Expand All @@ -167,7 +168,9 @@ const ScrimmageRequestDropdown: React.FC<{
setCurrentMapSearch: React.Dispatch<React.SetStateAction<string | null>>;
}> = ({ teams, userteam, maps, setCurrentTeamSearch, setCurrentMapSearch }) => {
const [TeamValue, setValue] = useState<string | null>(null);
const [MapValue, setMapValue] = useState<string | null>(maps.length ? maps[0] : null);
const [MapValue, setMapValue] = useState<string | null>(
maps.length ? maps[0] : null,
);

const teamnames = teams.map((team: Team) => team.name);
const index = teamnames.indexOf(userteam);
Expand All @@ -187,7 +190,6 @@ const ScrimmageRequestDropdown: React.FC<{
break;
}
}
return;
};

return (
Expand All @@ -211,7 +213,7 @@ const ScrimmageRequestDropdown: React.FC<{
}}
id='maps_dropdown'
options={maps}
sx={{ width: 800, marginLeft: 2}}
sx={{ width: 800, marginLeft: 2 }}
renderInput={(params) => <TextField {...params} label='Maps' />}
/>
<Button
Expand Down Expand Up @@ -278,11 +280,11 @@ const Scrimmages: NextPage = ({
<Card.Body>
<Card.Title>Available Scrimmages</Card.Title>
<ScrimmageRequestDropdown
teams={teams}
userteam={userTeam}
maps={maps}
setCurrentTeamSearch={setCurrentTeamSearch}
setCurrentMapSearch={setCurrentMapSearch}
teams={teams}
userteam={userTeam}
maps={maps}
setCurrentTeamSearch={setCurrentTeamSearch}
setCurrentMapSearch={setCurrentMapSearch}
/>
</Card.Body>
</Card>
Expand Down Expand Up @@ -411,21 +413,20 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
}));
}

let maps : string[] = [];
let maps: string[] = [];

await axios.get(`${process.env.MATCHMAKING_SERVER_IP}/maps/list?pool=unranked`)
.then((response : AxiosResponse) => {
if(response.status === 200)
maps = response.data.pools[0].mapIds;
}
);
await axios
.get(`${process.env.MATCHMAKING_SERVER_IP}/maps/list?pool=unranked`)
.then((response: AxiosResponse) => {
if (response.status === 200) maps = response.data.pools[0].mapIds;
});

return {
props: {
userTeam: team,
teams,
configData: configs,
maps
maps,
}, // will be passed to the page component as props
};
};
Expand Down
6 changes: 3 additions & 3 deletions src/pages/user/submissions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,14 @@ const Submissions: NextPage = ({
const uploadFile = async (user: string) => {
if (!file) return;
// if filename contains spaces or ':' reject
if(file.name.includes(' ') || file.name.includes(':')) {
if (file.name.includes(' ') || file.name.includes(':')) {
toast.error('File name cannot contain spaces or colons.');
return;
}

const time = new Date().toISOString();
const timeString = time.split('.')[0].replace(/:/g, '-');

const submissionID = uuidv4();
const fileName = `bot-${user}-${timeString}-${submissionID}.py`;
const { data } = await axios.post('/api/user/s3-upload', {
Expand Down

0 comments on commit 6cc3d0d

Please sign in to comment.