mirror of https://github.com/sundowndev/http.git
test: update fixture
parent
d03ab9282c
commit
7056f151d8
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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'
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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!')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue