Requests
useRequest()
useRequest is the low-level composable that is used by useActions. You can use this directly if you need more control over a Request.
useRequest does 3 things:
- Middleware
- Response Transformation
- Wraps everything reactively
Doing Requests
ts
const { request } = useRequest()
const response = await request<{ id: number }[]>({
method: "get",
url: "my-url",
params: {
foo: "bar"
},
})
// response is a Ref of type we give in