From 0bcd9a97edaf90ac208c23a3161f0786fcc77193 Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Fri, 25 Aug 2023 13:00:10 +0200 Subject: [PATCH] fix: use `FetchError` from `ofetch` again --- docs/guide/faq-how-to-track-errors.md | 4 +- package.json | 8 +- playground/pages/jsonPlaceholder.vue | 2 +- playground/pages/petStore.vue | 3 +- pnpm-lock.yaml | 454 +++++++++++++------------- src/module.ts | 1 - src/runtime/composables/useApiData.ts | 8 +- src/runtime/server/handler.ts | 4 +- test/fixture/pages/invalid.vue | 2 +- 9 files changed, 242 insertions(+), 244 deletions(-) diff --git a/docs/guide/faq-how-to-track-errors.md b/docs/guide/faq-how-to-track-errors.md index 2cf2485..aa3e63d 100644 --- a/docs/guide/faq-how-to-track-errors.md +++ b/docs/guide/faq-how-to-track-errors.md @@ -11,7 +11,7 @@ This ensures you can still track errors in your client-side code. With the latter property `data`, you can access the **error response body** returned from your API: ```ts -import type { FetchError } from '#nuxt-api-party' +import type { FetchError } from 'ofetch' // Log your API's error response console.error('Error response body:', (error as FetchError).data) @@ -57,7 +57,7 @@ watchEffect(() => { ### Usage with `$jsonPlaceholder` ```ts -import type { FetchError } from '#nuxt-api-party' +import type { FetchError } from 'ofetch' function onSubmit() { try { diff --git a/package.json b/package.json index d3caf25..8c6b638 100644 --- a/package.json +++ b/package.json @@ -50,11 +50,11 @@ "dependencies": { "@nuxt/kit": "^3.6.5", "defu": "^6.1.2", - "ofetch": "^1.3.2", + "ofetch": "^1.3.3", "ohash": "^1.1.3", "pathe": "^1.1.1", "scule": "^1.0.0", - "ufo": "^1.2.0" + "ufo": "^1.3.0" }, "optionalDependencies": { "openapi-typescript": "^5 || ^6" @@ -63,12 +63,12 @@ "@antfu/eslint-config": "^0.41.0", "@nuxt/module-builder": "^0.4.0", "@nuxt/test-utils": "^3.6.5", - "@types/node": "^20.5.4", + "@types/node": "^20.5.6", "bumpp": "^9.2.0", "eslint": "^8.47.0", "nuxt": "^3.6.5", "nuxt-api-party": "workspace:*", - "typescript": "^5.1.6", + "typescript": "^5.2.2", "vitest": "^0.33.0", "vue-tsc": "^1.8.8" } diff --git a/playground/pages/jsonPlaceholder.vue b/playground/pages/jsonPlaceholder.vue index f9bc023..686c16c 100644 --- a/playground/pages/jsonPlaceholder.vue +++ b/playground/pages/jsonPlaceholder.vue @@ -1,6 +1,6 @@