Can you show where you are validating the request?
Nov 6, 2022
7
Level 7
Failed to load resource: the server responded with a status of 422 (Unprocessable Content)
trying to post a note with contact_id, here is my code:
data() {
return {
note: {
note: "",
contact_id: "",
},
};
},
methods: {
async addNote() {
this.note = {
note: this.note.note,
contact_id: this.$route.params.id,
};
try {
console.log("NOTE: ", this.note);
// axios.post("note", this.note).then(() => {
// Swal.fire({
// title: `Successfully added`,
// text: ` ${this.note.note} has been added!`,
// icon: "success",
// });
// this.$emit("addedNote", this.note);
// // this.clearFields();
// });
} catch (error) {
console.log("ERROR: ", error);
}
},
},
this is what is logged in the console:
Proxy {note: 'test note', contact_id: '9'}
If I attempt to post it by un commenting the code for the axios post, I get:
Failed to load resource: the server responded with a status of 422 (Unprocessable Content)
Level 35
Look in your controller where you are creating the note. Do you see something like this?
$request->validate([
'first_name' => 'required'
]);
If so remove it. If not, are you sure your router isn't directing your request to a different controller?
1 like
Please or to participate in this conversation.