@@ -12,13 +12,17 @@ import { useFetch } from 'vue-use-web';
1212const { isLoading , json , text , error , success } = useFetch (' http://myurl.com' );
1313```
1414
15- | State | Type | Description |
16- | --------- | --------- | -------------------------------------------------------------- |
17- | isLoading | ` Boolean ` | If the request is pending. |
18- | error | ` Boolean ` | If the request resulted in a non 200 status code. |
19- | success | ` Boolean ` | If the request is successful. i.e resulted in 200 status code. |
20- | json | ` any ` | The response body as JSON. |
21- | text | ` string ` | The raw response body as a string. |
15+ | State | Type | Description |
16+ | ---------- | ------------------------ | -------------------------------------------------------------------------------- |
17+ | error | ` Boolean ` | If the request resulted in a non 200 status code. |
18+ | headers | ` Record<string, string> ` | The response headers. |
19+ | isLoading | ` Boolean ` | If the request is pending. |
20+ | json | ` any ` | The response body as JSON. |
21+ | status | ` number ` | The HTTP status code. |
22+ | statusText | ` number ` | The HTTP status text, eg: "OK" for 200. |
23+ | success | ` Boolean ` | If the request is successful. i.e resulted in 200 status code. |
24+ | text | ` string ` | The raw response body as a string. |
25+ | type | ` string ` | [ Response type] ( https://developer.mozilla.org/en-US/docs/Web/API/Response/type ) . |
2226
2327## Methods
2428
@@ -50,20 +54,11 @@ const { cancel } = useFetch(elem);
5054</template>
5155
5256<script>
53- import { useFetch } from " vue-use-web" ;
57+ import { useFetch } from ' vue-use-web' ;
5458
5559export default {
5660 setup() {
57- const {
58- isLoading,
59- error,
60- success,
61- cancel,
62- text,
63- blob,
64- json,
65- cancelled
66- } = useFetch("/data.json");
61+ const { isLoading, error, success, cancel, text, blob, json, cancelled } = useFetch('/data.json');
6762
6863 return { isLoading, error, success, cancel, text, blob, json, cancelled };
6964 }
0 commit comments