Skip to content

Commit

Permalink
[frontend] Fixes around buttons in modal windows(tmp)
Browse files Browse the repository at this point in the history
  • Loading branch information
lim396 committed Jan 30, 2024
1 parent 565751b commit 8371c5e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
5 changes: 2 additions & 3 deletions frontend/app/ui/room/ban-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ export default function BanItem({

const onBan = async (userId: number) => {
setIsClicked(true);
if (!roomId) {
throw new Error("not found room");
}
const result = await banUser(roomId, userId);
if (result === "Success") {
router.refresh();
} else {
setIsClicked(false);
}
};

Expand Down
10 changes: 4 additions & 6 deletions frontend/app/ui/room/invite-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ export default function InviteItem({

const onInvite = async (userId: number) => {
setIsClicked(true);
if (!roomId) {
throw new Error("not found room");
}
const res = await inviteUserToRoom(roomId, userId);
if (res !== "Success") {
throw new Error("failed to invite");
if (res === "Success") {
router.refresh();
} else {
setIsClicked(false);
}
router.refresh();
};

return (
Expand Down
5 changes: 2 additions & 3 deletions frontend/app/ui/room/unban-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ export default function UnbanItem({

const onUnban = async (userId: number) => {
setIsClicked(true);
if (!roomId) {
throw new Error("not found room");
}
const result = await unbanUser(roomId, userId);
if (result === "Success") {
router.refresh();
} else {
setIsClicked(false);
}
};

Expand Down

0 comments on commit 8371c5e

Please sign in to comment.