How to use the vuex/store.state function in vuex

To help you get started, we’ve selected a few vuex examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tyllo / Framework7-VueJS / src / services / fetch / utils.js View on Github external
export function fetch(settings = {}, params) {
  var { fixture, parser } = params

  extendSettings(settings, params)

  // TODO: remove this to another point!!!
  var auth = store.state.auth
  if (auth.login === 'demo' && auth.password === 'demo') {
    return fixture()
  }

  return Vue.http.get(settings).then(parser)
}
github tyllo / Framework7-VueJS / src / services / fetch / utils.js View on Github external
function extendSettings(settings, { url }) {
  var headers = {
    'Content-Type': 'application/json',
    Authorization: `Bearer ${store.state.auth.secret}`,
  }

  // if null - disallow headers in fetch
  if (settings.headers !== null) {
    settings.headers = Object.assign(headers, settings.headers || {})
  }

  settings.url = url
}
github tyllo / Framework7-VueJS / src / modules / main.js View on Github external
style().then(load).then( commons => {
  var { Vue, i18n } = commons

  Vue.use(i18n, {
    lang: 'current',
    locales: store.state.locales,
  })

  router.start(Vue.extend({
    components: { app }
  }), document.body)
})