const submitForm = () =>{
http.post('/createpost',{title:title,description:description}).then(res=>{
alert(2);
});
}
Above is the code inside submit from
Below is the backend coding in Api.php
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
return $request->user();
});
Route::post('/createpost',[UserPostController::class, 'create']);
for the above coding i get below eroor when pressing submit button on the page.