Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2878d0b

Browse files
committedAug 7, 2022
Add data-fetching snippets #6
- nfetch - nfetch-lazy - nasyncdata - nasyncdata-lazy
1 parent 9c8c2aa commit 2878d0b

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
 

‎package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@
5757
{
5858
"language": "html",
5959
"path": "./snippets/nuxt-template.code-snippets"
60+
},
61+
{
62+
"language": "javascript",
63+
"path": "./snippets/nuxt-script.code-snippets"
64+
},
65+
{
66+
"language": "typescript",
67+
"path": "./snippets/nuxt-script.code-snippets"
6068
}
6169
]
6270
}

‎snippets/nuxt-script.code-snippets

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"Nuxt useFetch": {
3+
"prefix": "nfetch",
4+
"body": [
5+
"const { data: ${1:name} } = await useFetch('${2:path}')"
6+
],
7+
"description": "Nuxt useFetch composable"
8+
},
9+
"Nuxt useLazyFetch": {
10+
"prefix": "nfetch-lazy",
11+
"body": [
12+
"const { pending, data: ${1:name} } = await useLazyFetch('${2:path}')"
13+
],
14+
"description": "Nuxt useLazyFetch composable"
15+
},
16+
"Nuxt useAsyncData": {
17+
"prefix": "nasyncdata",
18+
"body": [
19+
"const { data: ${1:name} } = await useAsyncData('${2:requestKey}', () => $fetch('${3:path}'))"
20+
],
21+
"description": "Nuxt useAsyncData composable"
22+
},
23+
"Nuxt useLazyAsyncData": {
24+
"prefix": "nasyncdata-lazy",
25+
"body": [
26+
"const { pending, data: ${1:name} } = await useLazyAsyncData('${2:requestKey}', () => $fetch('${3:path}'))"
27+
],
28+
"description": "Nuxt useLazyAsyncData composable"
29+
},
30+
}

0 commit comments

Comments
 (0)
Please sign in to comment.