test: update fixture

master
pooya parsa 2019-03-18 21:47:53 +03:30
parent d03ab9282c
commit 7056f151d8
5 changed files with 12 additions and 12 deletions

View File

@ -7,7 +7,7 @@
<script>
export default {
async asyncData({ app }) {
let res = await app.$axios.$get('foo/bar')
const res = await app.$http.$get('foo/bar')
return {
res
}

View File

@ -14,7 +14,7 @@ export default {
async mounted() {
// Request with full url becasue we are in JSDom env
this.res = await this.$axios.$get('http://localhost:3000/test_api/foo/bar')
this.res = await this.$http.$get('http://localhost:3000/test_api/foo/bar')
}
}
</script>

View File

@ -13,16 +13,16 @@
async fetch({app, route}) {
let doLogin = route.query.login !== undefined
if (doLogin) {
app.$axios.setHeader('sessionId', reqCtr++)
app.$http.setHeader('sessionId', reqCtr++)
}
},
computed: {
axiosSessionId() {
return this.$axios.defaults.headers.common.sessionId
return this.$http.defaults.headers.common.sessionId
},
axiosEncoding() {
return this.$axios.defaults.headers.common['Accept-Encoding']
return this.$http.defaults.headers.common['Accept-Encoding']
}
}
}

View File

@ -1,8 +1,8 @@
export default function ({ $axios, redirect }) {
$axios.onRequest((config) => {
export default function ({ $http, redirect }) {
$http.onRequest((config) => {
// eslint-disable-next-line no-console
console.log('SPY: ' + config.url)
$axios.defaults.xsrfHeaderName = 'X-CSRF-TOKEN'
$http.defaults.xsrfHeaderName = 'X-CSRF-TOKEN'
})
}

View File

@ -1,12 +1,12 @@
export default {
actions: {
nuxtServerInit({ commit }, ctx) {
if (!ctx.$axios) {
throw new Error('$axios is not defined!')
if (!ctx.$http) {
throw new Error('$http is not defined!')
}
if (!ctx.app.$axios) {
throw new Error('$axios is not defined!')
if (!ctx.app.$http) {
throw new Error('$http is not defined!')
}
}
}