Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Http options don't work when included with Vue instance #717

Open
websanova opened this issue Jan 14, 2019 · 1 comment
Open

Http options don't work when included with Vue instance #717

websanova opened this issue Jan 14, 2019 · 1 comment

Comments

@websanova
Copy link

I'm having issue with options.

When using Vue.http.options.root it's all good, when including with Vue instance it seems to be ignored.

Same as issue here:

#487

Not sure why that was closed.

import Vue from 'vue'
import App from 'PAGES/Index.vue'

import http from './http'
import store from './store'
import router from './router'

import './config/icons.js'
import './config/plugins.js'
import './config/components.js'

Vue.config.productionTip = false

// Vue.http.options.root = 'https://testing123.com';

new Vue({
    el: '#app',
    http: {
        root: 'https://testing123.com'
    },
    store: store,
    router: router,
    render: h => h(App)
})
@scottescue
Copy link

scottescue commented Mar 11, 2019

This is broken for me as well. However I was able to monkey patch it by adding this mixin to my root component:

  Vue.mixin({
    beforeCreate() {
      if (!this.$options.http) {
        this.$options.http = this.$root.$options.http;
      }
    }
  });

I'm using:

  • vue: 2.6.7
  • vue-resource: 1.5.1

Edit: simplifying mixin patch

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants