I'm trying to make a link to a Laravel view called faq.blade.php from my Vue component, I tried to use axios and even when it returns the console.log I left after the response it isn't loading the view. How could I solve it?
FaqController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class FAQController extends Controller
{
public function index(){
return view('main.faq');
}
}
I try to call it from this component: Main.vue (which is in the '/' route)
<b-list-group-item align="left" @click="faq"><strong>></strong> FAQ</b-list-group-item>
<b-list-group-item align="left" @click="services"><strong>></strong> Services</b-list-group-item>
<script>
export default {
methods: {
faq() {
axios.get('/faq')
.then(res => {
console.log("faq");
})
},
services(){
axios.get('/services')
.then(res => {
console.log("services");
})
}
}
}
</script>
Routes: web.php
Route::get('/', function () {
return view('main.landing');
});
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
Route::get('/faq', 'FAQController@index')->name('faq');
Route::get('/services', 'ServicesController@index')->name('services');