Axios.put retriving "500 (Internal Server Error)"

Published 6 days ago by Vicente123

Hi, I'm trying to update data using axios.put method. It WAS WORKING till I moved the route into some routes group with prefix and middlewares. I'm pretty sure that I'm missing tokens. Code:

axios.put(self.postUrl.replace('%%ID%%', id), {
                    id: id,
                    title: $('#prov_program_name').val(),
                    description: $('#prov_program_description').val(),
                    session: $('#prov_program_session').val()
                 
                })

Route::group(['prefix' => 'rest', 'middleware' => 'auth.basic'], function () {
    Route::put('/rest/program-instances/update', '[email protected]')->name('rest.program_instances.update');

});

My form does not have a single token declared. But as i said, it was working before moving this route.

ejdelmonico

I don't think you need to put the rest. in the route name. Try it with ->name('program_instances.update)

Vicente123

@ejdelmonico mmm... that doesn't seems to fix the problem, any other idea?

ejdelmonico

Try /rest in the prefix value field.

jcmargentina

I think you need to send a CSRF token

you can render one using blade , like {{ csrf_token() }}

Please sign in or create an account to participate in this conversation.