Skip to content

Commit

Permalink
fix: disabled button when create team (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
GZTimeWalker committed Dec 31, 2023
1 parent 0d679ee commit 95fb328
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/GZCTF/ClientApp/src/components/TeamCreateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ interface TeamEditModalProps extends ModalProps {
const TeamCreateModal: FC<TeamEditModalProps> = (props) => {
const { isOwnTeam, mutate, ...modalProps } = props
const [createTeam, setCreateTeam] = useState<TeamUpdateModel>({ name: '', bio: '' })
const [disabled, setDisabled] = useState(false)
const theme = useMantineTheme()

const { t } = useTranslation()

const onCreateTeam = () => {
setDisabled(true)

api.team
.teamCreateTeam(createTeam)
.then((res) => {
Expand All @@ -44,6 +47,7 @@ const TeamCreateModal: FC<TeamEditModalProps> = (props) => {
})
.catch((e) => showErrorNotification(e, t))
.finally(() => {
setDisabled(false)
modalProps.onClose()
})
}
Expand Down Expand Up @@ -85,7 +89,7 @@ const TeamCreateModal: FC<TeamEditModalProps> = (props) => {
maxRows={4}
onChange={(event) => setCreateTeam({ ...createTeam, bio: event.currentTarget.value })}
/>
<Button fullWidth variant="outline" onClick={onCreateTeam}>
<Button fullWidth variant="outline" onClick={onCreateTeam} disabled={disabled}>
创建队伍
</Button>
</Stack>
Expand Down

0 comments on commit 95fb328

Please sign in to comment.