Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Potentially fix user adding
  • Loading branch information
regalijan committed Nov 8, 2023
1 parent bd7e629 commit 7087b2e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions components/GameModManagementModal.tsx
Expand Up @@ -45,8 +45,8 @@ export default function (props: { isOpen: boolean; onClose: () => void }) {
})();
}, [props.isOpen]);

async function addUser(user: string) {
if (!user || !user.match(/^\d{17,19}$/)) {
async function addUser() {
if (!userToAdd || !userToAdd.match(/^\d{17,19}$/)) {
toast({
description: "Please check your input and try again",
status: "error",
Expand All @@ -57,7 +57,7 @@ export default function (props: { isOpen: boolean; onClose: () => void }) {
}

const addResp = await fetch("/api/gme/add", {
body: JSON.stringify({ user }),
body: JSON.stringify({ user: userToAdd }),
headers: {
"content-type": "application/json",
},
Expand All @@ -75,7 +75,7 @@ export default function (props: { isOpen: boolean; onClose: () => void }) {
}

toast({
description: `User ${user} added`,
description: `User ${userToAdd} added`,
status: "success",
title: "Success",
});
Expand Down Expand Up @@ -148,7 +148,7 @@ export default function (props: { isOpen: boolean; onClose: () => void }) {
onChange={(e) => setUserToAdd(e.target.value)}
placeholder="1234567890987654321"
/>
<Button onClick={async () => await addUser(userToAdd)}>Add</Button>
<Button onClick={async () => await addUser()}>Add</Button>
</HStack>
</ModalBody>
</ModalContent>
Expand Down

0 comments on commit 7087b2e

Please sign in to comment.