Skip to content

Commit ad2136c

Browse files
authored
Merge pull request sdras#88 from debs-obrien/patch-1
feat: add axios option for nuxt
2 parents 00f7c97 + 9ee8b4a commit ad2136c

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,17 @@ You can enable tab completion (recommended) by opening `Code > Preferences > Set
167167
| `nfont` | link to include fonts in a nuxt project, in nuxt-config |
168168
| `ncss` | link to css assets such as normalize |
169169

170+
170171
### Nuxt Page
171172

172-
| Snippet | Purpose |
173-
| ------------ | ----------------- |
174-
| `nasyncdata` | Nuxt asyncData |
175-
| `nfetch` | Nuxt Fetch |
176-
| `nhead` | Nuxt Head |
177-
| `nparam` | Nuxt Route Params |
173+
| Snippet | Purpose |
174+
| ----------------- | -------------------------------- |
175+
| `nasyncdata` | Nuxt asyncData |
176+
| `nasyncdataaxios` | Nuxt asyncData with Axios module |
177+
| `nfetch` | Nuxt Fetch |
178+
| `nfetchaxios` | Nuxt Fetch with Axios module |
179+
| `nhead` | Nuxt Head |
180+
| `nparam` | Nuxt Route Params |
178181

179182
### Extra (plaintext)
180183

snippets/nuxt-script.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@
99
],
1010
"description": "Nuxt asyncData"
1111
},
12+
"Nuxt Async": {
13+
"prefix": "nasyncdataaxios",
14+
"body": [
15+
"async asyncData ({ ${1:$axios}, { ${2:params} }) {",
16+
"\tconst data = await $axios.$get(`${3:endpoint/${params.slug}}`)",
17+
"\treturn { data }",
18+
"},"
19+
],
20+
"description": "Nuxt asyncData with Axios module"
21+
},
1222
"Nuxt Fetch": {
1323
"prefix": "nfetch",
1424
"body": [
@@ -19,6 +29,15 @@
1929
],
2030
"description": "Nuxt Fetch"
2131
},
32+
"Nuxt Fetch with Axios": {
33+
"prefix": "nfetchaxios",
34+
"body": [
35+
"async fetch () {",
36+
"\tlet this.data = await this.$axios.$get('${1:endpoint/${this.$route.params.slug}}')",
37+
"},"
38+
],
39+
"description": "Nuxt Fetch with Axios module"
40+
},
2241
"Nuxt Route Params": {
2342
"prefix": "nparam",
2443
"body": ["this.$route.params.${1:id}"],

0 commit comments

Comments
 (0)