Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
}
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
}
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)
})