I'm attempting to create a hyperlink to a Laravel view named faq.blade.php from my Vue component. I've tried using axios, and even though it logs the response in the console, the view isn't loading. How can I resolve this issue?
FaqController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class FAQController extends Controller
{
public function index(){
return view('main.faq');
}
}
I'm trying to access it from this component: Main.vue (located 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');