How to use nuxtjs axios in actions #1469
Unanswered
ishratali1997
asked this question in
Help and Questions
Replies: 2 comments 1 reply
-
if you using nuxt bridge this should be like that: async getUsersData(page=1) {
const { $axios } = useNuxtApp();
const { data } = await $axios.$get(`/users?page=${page}`)
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
I am using Nuxt Js With Vue Js 2. This is my dependencies
"dependencies": {
***@***.***/auth-next": "5.0.0-1648802546.c9880dc",
***@***.***/axios": "^5.13.6",
***@***.***/composition-api": "^0.32.0",
***@***.***/nuxt": "^0.1.9",
"core-js": "^3.19.3",
"nuxt": "^2.15.8",
"pinia": "^2.0.14",
"vform": "^2.1.2",
"vue": "^2.6.14",
"vue-server-renderer": "^2.6.14",
"vue-template-compiler": "^2.6.14",
"vuetify": "^2.6.1",
"webpack": "^4.46.0"
},
…On Sun, Jul 24, 2022 at 12:04 AM Oğuzhan ***@***.***> wrote:
if you using nuxt bridge this should be like that:
async getUsersData(page=1) {
const { $axios } = useNuxtApp();
const { data } = await $axios.$get(`/users?page=${page}`)}
—
Reply to this email directly, view it on GitHub
<#1469 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AM7LX3SNRYJ6WBYL57KRFFDVVQ65JANCNFSM54NQKCJA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to fetch users using Nuxt js Axios like
actions: {
async getUsersData(page=1) {
const { data } = await $axios.$get(
/users?page=${page}
)this.users = data
},
},
Here in action $axios or this.$axios in not working.
Here is the link of Nuxt Js Axios https://axios.nuxtjs.org/usage
Beta Was this translation helpful? Give feedback.
All reactions