Disable revoke button if ticket link does not match format
This commit is contained in:
parent
74157822dc
commit
bfb027310f
@ -67,6 +67,7 @@ export default function () {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const { isOpen, onClose, onOpen } = useDisclosure();
|
||||
const toast = useToast();
|
||||
const ticketRegex = /https:\/\/carcrushers\.modmail\.dev\/logs\/[a-f\d]{12}$/;
|
||||
|
||||
async function getHistory() {
|
||||
setVisible(false);
|
||||
@ -260,11 +261,7 @@ export default function () {
|
||||
maxLength={49}
|
||||
/>
|
||||
<InputRightElement>
|
||||
{ticketLink.match(
|
||||
/https:\/\/carcrushers\.modmail\.dev\/logs\/[a-f\d]{12}$/,
|
||||
)
|
||||
? validIcon
|
||||
: invalidIcon}
|
||||
{ticketLink.match(ticketRegex) ? validIcon : invalidIcon}
|
||||
</InputRightElement>
|
||||
</InputGroup>
|
||||
</ModalBody>
|
||||
@ -279,6 +276,7 @@ export default function () {
|
||||
</Button>
|
||||
<Button
|
||||
colorScheme="red"
|
||||
disabled={!Boolean(ticketLink.match(ticketRegex))}
|
||||
ml="8px"
|
||||
onClick={async () => await revokePunishment()}
|
||||
>
|
||||
|
Loading…
x
Reference in New Issue
Block a user