Csrf is 419. Sounds like you are blocked by some middleware perhaps?
Jan 9, 2023
7
Level 8
ReactJS InertiaJS 403
Pretty sure it has something to do with the CSRF but am searching around and coming up with nothing.
403
This action is unauthorized.
import React from 'react'
import TextInput from '../TextInput.jsx'
import SelectBox from '../SelectBox.jsx'
import PrimaryButton from '../PrimaryButton.jsx'
import { Link, useForm } from '@inertiajs/inertia-react';
const AddKin = () => {
const { data, setData, post, processing, errors, reset } = useForm({
parent: '',
name: '',
});
const onHandleChange = (event) => {
setData(event.target.name, event.target.type === 'checkbox' ? event.target.checked : event.target.value);
};
const parents = [
{ id: 1, name: 'Josh', age: 35 },
{ id: 2, name: 'Jim', age: 23 },
{ id: 3, name: 'Sarah', age: 25 },
];
const submit = (e) => {
e.preventDefault();
console.log(data.parent + ' ' + data.name)
post(route('student.store'));
};
return (
<form onSubmit={submit}>
<div>
<div className="bg-white overflow-hidden shadow-sm sm:rounded-t-lg bg-gradient-to-r from-cyan-200 to-blue-200">
<div className="p-4 text-lg text-left">Add Kin</div>
</div>
<div className="bg-white overflow-hidden shadow-sm sm:rounded-b-lg">
<div className="p-4 text-lg">
<p>Parent Account</p>
<SelectBox
name="parent"
id="parent"
className="w-full py-3 shadow"
objects={parents}
handleChange={onHandleChange}
/>
<p>Name</p>
<TextInput
type="text"
name="name"
id="name"
className="w-full py-3 shadow"
handleChange={onHandleChange}
/>
<PrimaryButton className="py-5 mt-8 w-full" processing={processing}>
Add
</PrimaryButton>
</div>
</div>
</div>
</form>
)
}
export default AddKin
Level 102
@Randy_Johnson maybe you have return false in the StoreStudentRequest::authorize()
Or something that equals false at least
Please or to participate in this conversation.