When I'm in http://127.0.0.1:8000/edit/4, and I use this Vue.js method, I get redirected to http://127.0.0.1:8000/edit/api/book/update/4, when I want to go to http://127.0.0.1:8000/api/book/update/4
updateBook() {
let uri = 'api/book/update/${this.$route.params.id}'
this.axios
.post(`api/book/update/${this.$route.params.id}`, this.book)
.then((response) => {
this.$router.push({name: 'home'});
});
}
and my routers through laravel are:
Route::group(['prefix' => 'book'], function () {
Route::post('add', [BookController::Class,'add']);
Route::get('edit/{id}', [BookController::Class,'edit']);
Route::post('update/{id}', [BookController::Class,'update']);
Route::delete('delete/{id}', [BookController::Class,'delete']);});