1

I am trying to deploy code to a live server built in laravel vuejs.i have subdomain.and in sub domain i have created a subfolder. I have followed this link .The issue is that the project runs but any api is not working. It gives 404. From the console I can see that it goes to subdomain not to subdomain sub directory. So I have changed the code .

this is api call in index.vue

getSchools () {
      this.loading = true
      this.schools = []

      localStorage.setItem("filtersTableSchools", JSON.stringify(this.filters));

      axios.post(`/subfoldername/api/schools/filtersuper?page=${this.filters.pagination.current_page}`, this.filters)
      .then(response => {
        this.schools = response.data.schools.data;
        this.plans = response.data.plans;
        this.currency = response.data.currency;
        this.billing_cycle = response.data.billing_cycle;
        delete response.data.data;
        this.filters.pagination = response.data
        this.loading = false
      })
    },
    restoreOriginalPlan()
    {
      var original_plan = null;
      for (var i = 0; i < this.plans.length; i++) {
        if (this.plans[i].id == this.selectedschool.plan_id){
          original_plan = this.plans[i];
          break;
        }
      }
      this.selectedschool.plan = original_plan;
    },

This is the rout i called

// api
        Route::group(['prefix' => 'subfolder/api/schools'], function() {
            Route::post('/filter', 'SchoolsController@filter');
            Route::delete('/{school}', 'SchoolsController@destroy');
            Route::post('/store', 'SchoolsController@store');
            Route::post('/filtersuper', 'SchoolsController@filtersuper');
            Route::post('/storesuper', 'SchoolsController@storesuper');
        });

After change in code i have rebuild using following command

npm run development

still axios post goes to /api/schools/filtersuper. This happened in the entire project.So any one can tell what needs to change to make it work.

Mohit-Tech
  • 102
  • 7

0 Answers0