7

I have created a new tool within Nova and I have to access my laravel api defined in /routes/api.php not the one in nova-components/component-name/routes/api.php

My code within the Vue component looks like this:

getCertificateTypes() {
    Nova.request().get('/api/certificate-type')
       .then(response => {
           // my code
       });
},

This returns a 401 Unauthorized

This is what I tried so far:

Added this code to my routes() function in the ServiceProvider of the tool created

Route::middleware(['nova', Authorize::class])
        ->prefix('laravel')
        ->group(__DIR__.'/../../../routes/api.php');

Now, if I call Nova.request().get('/laravel/api/certificate-type') I get a 404 not found.

What am I missing here?

iosifv
  • 1,153
  • 1
  • 10
  • 26
  • Is the routes method called in the service provider and is your serivce provider getting called? How does your routes/api.php look like? – bernhardh Feb 15 '20 at 11:13
  • Did you find a solution to your question eventually? I am facing something similar at the moment. – Mena Jun 02 '20 at 21:53
  • Unfortunately no, I just created a new controller in Nova which will get the data through the backend and call that controller. – iosifv Jun 03 '20 at 13:29

0 Answers0