0

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']);});
  • 1
    try `let uri = '/api/book/update/${this.$route.params.id}'` and .post(`/api/book/update/${this.$route.params.id}` – bassxzero May 26 '21 at 08:36
  • sadly doesn't work it seems like it only goes back one / – Thornit May 26 '21 at 20:25
  • I'm pretty positive your problem is about relative and absolute paths. Here is a good example of how it works in html docs. https://stackoverflow.com/a/24028813/909973 – bassxzero May 27 '21 at 00:53

0 Answers0