반응형
버전 정보
Nuxt 3.6.2
useAsyncData
const {data: testResponse} = await useAsyncData('userDetail', () => $fetch('http://localhost:8080/list/load', {
query: {
test1: 'test1',
test2: 'test2'
}
}));
일반적으로 GET방식의 통신을 위해 사용된다. 위 통신을 통해 얻은 결과값의 .data가 testResponse라는 변수에 들어가게 된다.
useFetch · Nuxt Composables
This composable provides a convenient wrapper around useAsyncData and $fetch. It automatically generates a key based on URL and fetch options, provides type hints for request url based on server routes, and infers API response type. useFetch is a composabl
nuxt.com
useFetch
const kakaoLogin = async () => {
const {response} = await useFetch('http://localhost:8080/kakao/login', {
method: 'POST',
body: {
code: route.query.code
}
});
}
일반적으로 POST방식의 통신을 위해 사용된다.
useAsyncData · Nuxt Composables
Within your pages, components, and plugins you can use useAsyncData to get access to data that resolves asynchronously. useAsyncData is a composable meant to be called directly in a setup function, plugin, or route middleware. It returns reactive composabl
nuxt.com
반응형
'프로그래밍 일기 > Front-End' 카테고리의 다른 글
[Nuxt3] BootStrap 부트스트랩 css, js 적용 (0) | 2023.07.30 |
---|---|
Nuxt3 vue3 formData 다중 파일 업로드, 파라미터 전달 (0) | 2023.07.12 |
인텔리제이 IntelliJ Nuxt.js 생성 (Nuxt3) (0) | 2023.07.06 |
인텔리제이 IntelliJ Nuxt.js 생성 (nuxt2) (0) | 2023.07.04 |
구글 QR API 생성 방법 QR코드 만들기 (0) | 2022.07.10 |