SWRV wrapper for aspida
npm install @aspida/swrv
- Using npm:
``sh`
$ npm install aspida @aspida/swrv @aspida/axios swrv axios
# $ npm install aspida @aspida/swrv @aspida/fetch swrv
# $ npm install aspida @aspida/swrv @aspida/node-fetch swrv node-fetch
- Using Yarn:
`sh`
$ yarn add aspida @aspida/swrv @aspida/axios swrv axios
# $ yarn add aspida @aspida/swrv @aspida/fetch swrv
# $ yarn add aspida @aspida/swrv @aspida/node-fetch swrv node-fetch
src/index.vue
`vue
failed to load
loading...
hello {{ data.name }}
`
src/index.vue
`vue
failed to load
loading...
Status: {{ data.status }}
Headers: {{ JSON.stringify(data.headers) }}
Name: {{ data.body.name }}
`
useAspidaSWRV(client.user._userId(123), { query }) is an alias of useAspidaSWRV(client.user._userId(123), "$get", { query })
src/index.vue
`vue
failed to load
loading...
hello {{ data.name }}
`
`ts``
const { data: user } = useAspidaSWRV(client.user);
const { data } = useAspidaSWRV(() => user.value && client.articles, {
query: { userId: user?.id ?? 0 },
});
@aspida/swrv is licensed under a MIT License.