Fix build errors

This commit is contained in:
Darren Clarke 2023-03-14 17:40:24 +00:00
parent 785d0965e3
commit d0f1c1337c
28 changed files with 268 additions and 112 deletions

View file

@ -105,7 +105,7 @@ const Sidebar = ({ record }: any) => {
variant="outlined"
label="Message"
multiline
rows={3}
minRows={3}
fullWidth
size="small"
value={message}
@ -156,15 +156,15 @@ const handleRequestCode = async ({
"Content-Type": "application/json",
},
});
if (response && response.ok) {
onSuccess();
} else {
onFailure(response.status || 400);
}
} catch (error: any) {
console.error("Failed to request verification code:", error);
}
if (response && response.ok) {
onSuccess();
} else {
onFailure(response.status || 400);
}
};
const VerificationCodeRequest = ({
@ -222,7 +222,7 @@ const VerificationCaptcha = ({
setSubmitting(false);
};
const handleCaptchaChange = (value) => {
const handleCaptchaChange = (value: any) => {
if (value)
setCode(
value
@ -268,16 +268,16 @@ const VerificationCodeInput = ({
handleClose,
handleRestartVerification,
confirmVerification,
}) => {
}: any) => {
const [code, setValue] = React.useState("");
const [isSubmitting, setSubmitting] = React.useState(false);
const [isValid, setValid] = React.useState(false);
const [submissionError, setSubmissionError] = React.useState(undefined);
const translate = useTranslate();
const validator = (v) => v.trim().length === 6;
const validator = (v: any) => v.trim().length === 6;
const handleValueChange = (newValue) => {
const handleValueChange = (newValue: any) => {
setValue(newValue);
setValid(validator(newValue));
};
@ -300,11 +300,14 @@ const VerificationCodeInput = ({
if (response.status === 200) {
confirmVerification();
} else if (responseBody.message)
// @ts-expect-error
setSubmissionError(`Error: ${responseBody.message}`);
else
else {
setSubmissionError(
// @ts-expect-error
"There was an error, sorry about that. Please try again later or contact support."
);
}
};
const title =
@ -355,7 +358,7 @@ const VerificationCodeInput = ({
);
};
const VerificationCodeDialog = (props) => {
const VerificationCodeDialog = (props: any) => {
const [stage, setStage] = React.useState("request");
const onRequestSuccess = () => setStage("verify");
const onRestartVerification = () => setStage("request");
@ -406,7 +409,7 @@ const VerificationCodeDialog = (props) => {
);
};
const SignalBotShowActions = ({ basePath, data }) => {
const SignalBotShowActions = ({ basePath, data }: any) => {
const [open, setOpen] = React.useState(false);
const [verifyMode, setVerifyMode] = React.useState("");
const refresh = useRefresh();
@ -429,7 +432,7 @@ const SignalBotShowActions = ({ basePath, data }) => {
return (
<TopToolbar>
<EditButton basePath={basePath} record={data} />
<EditButton record={data} />
{data && !data.isVerified && (
<Button onClick={handleOpenSMS} color="primary">
Verify with SMS
@ -455,11 +458,9 @@ const SignalBotShowActions = ({ basePath, data }) => {
const SignalBotShow = (props: ShowProps) => (
<Show
// @ts-expect-error: Missing props
actions={<SignalBotShowActions />}
{...props}
title="Signal Bot"
// @ts-expect-error: Missing props
aside={<Sidebar />}
>
<SimpleShowLayout>