0

I am doing a project, during this project I am supposed to create api in laravel with an authentification system. I used jetstream and inertia. I have two folders separated one with my api and jetstream auth and another one with my vue.js project, where I will implement axios requests. How do I integrate jetstream to my vue.js project ? or am I doing something wrong maybe ? thank you in advance.

Marizona
  • 131
  • 1
  • 12

1 Answers1

0

Inertia is exactly to prevent to have the api and the vuejs/react/angular front end in separated projects or folders. With Inertia you can call a web or api route from your Laravel project. The route redirect to the controller and this must return a instance of Inertia. Specificly this structure:

Inertia::render('Users/allUsers',[
 'users' => Users::all()
];

Users/allUsers is a vuejs file inside the folder resources/js/Pages/

The [] is the list of props that you will recibe in your Vuejs page or component.

In the vuejs file Users/AllUsers you must define the props with the same name as the return in the controller.

    export default {
        props:['users'],
    }

And Jetstream is a set of reusable components. With this you dont have to use axios or ajax to get data from your backend.