Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const onDrop = useCallback((acceptedFiles) => {
const selectFile = acceptedFiles[0];
setPicture(URL.createObjectURL(selectFile));
// Upload file to the server.
const formData = new FormData();
formData.append('avatar_location', selectFile);
Inertia.post(`/profile/avatar`, formData);
}, []);
const inputClass = classNames('form-input flex-1 block w-full focus:shadow-outline-brand focus:border-brand-200 rounded-none rounded-r-md transition duration-150 ease-in-out sm:text-sm sm:leading-5', {
const form = {
...values,
body,
};
if (thread) {
Inertia.put(`/forum/threads/${id}`, form).then(() => {
setSending(false);
onClose();
window.location.reload();
}).catch((error) => {
console.error(error);
});
} else {
Inertia.post(`/forum/threads`, form).then(() => {
setSending(false);
}).catch((error) => {
console.error(error);
});
}
}
function handleSubmit(e: React.SyntheticEvent) {
e.preventDefault();
if (!isRobot) {
setSending(true);
Inertia.post("/register", values).then(() => {
setSending(false);
});
}
}
function handleSubmit(e: React.SyntheticEvent) {
e.preventDefault();
setSending(true);
Inertia.post("/password/email", { email }).then(() => {
setSending(false);
setEmail("");
});
}
function handleSubmit(e: React.SyntheticEvent) {
e.preventDefault();
setSending(true);
Inertia.post("/login", values).then(() => {
setSending(false);
});
}
function handleSubmit(e: React.SyntheticEvent) {
e.preventDefault();
setSending(true);
Inertia.post("/password/reset", values).then(() => {
setSending(false);
});
}
function markBestReply(e: React.SyntheticEvent, replyId: number) {
e.preventDefault();
Inertia.post(`/forum/threads/replies/${replyId}/best`);
}