Skip to content

Commit

Permalink
v4.19.0: updated API generator
Browse files Browse the repository at this point in the history
  • Loading branch information
fergusean committed Dec 4, 2024
1 parent 2acf79e commit a5f14e2
Show file tree
Hide file tree
Showing 4 changed files with 324 additions and 77 deletions.
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Attach",
"port": 9229,
"request": "attach",
"skipFiles": ["<node_internals>/**"],
"type": "node"
}
]
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@signal24/vue-foundation",
"type": "module",
"version": "4.18.1",
"version": "4.19.0",
"description": "Common components, directives, and helpers for Vue 3 apps",
"module": "./dist/vue-foundation.es.js",
"exports": {
Expand Down Expand Up @@ -37,15 +37,15 @@
"uuid": "^11.0.3"
},
"peerDependencies": {
"@signal24/openapi-client-codegen": "^1.1.0",
"@signal24/openapi-client-codegen": "^2.1.0",
"date-fns": "^3.0.6",
"lodash": "^4.17.21",
"vue": "^3.4.0"
},
"devDependencies": {
"@eslint/js": "9.14.0",
"@nabla/vite-plugin-eslint": "^2.0.4",
"@signal24/openapi-client-codegen": "^1.1.0",
"@signal24/openapi-client-codegen": "^2.1.0",
"@tsconfig/node22": "^22.0.0",
"@types/eslint__js": "^8.42.3",
"@types/jsdom": "^21.1.7",
Expand Down
16 changes: 12 additions & 4 deletions src/helpers/openapi.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import { installOpenApiClientInterceptors, isOpenApiError } from '@signal24/openapi-client-codegen/browser';
import { configureOpenApiClient, type OpenApiClient, type OpenApiClientOptions, OpenApiError } from '@signal24/openapi-client-codegen/browser';

import { UserError } from '.';

export function installApiClientInterceptors(clientOptions: Parameters<typeof installOpenApiClientInterceptors>[0]) {
installOpenApiClientInterceptors({
export function configureVfOpenApiClient(client: OpenApiClient, clientOptions: OpenApiClientOptions) {
configureOpenApiClient(client, {
...clientOptions,

onError(err, options) {
if (isOpenApiError(err) && err.status === 422 && typeof err.body === 'object' && 'error' in err.body) {
if (
err instanceof OpenApiError &&
err.response.status === 422 &&
typeof err.body === 'object' &&
err.body &&
'error' in err.body &&
typeof err.body.error === 'string'
) {
err = new UserError(err.body.error);
}

Expand Down
Loading

0 comments on commit a5f14e2

Please sign in to comment.