Skip to content

Commit 348dabd

Browse files
committed
fix: add silentError param to callAdminForthApi for improved error handling
1 parent 0e83b55 commit 348dabd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

adminforth/spa/src/utils.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,15 @@ export async function callApi({path, method, body, headers, silentError = false}
7171
}
7272
}
7373

74-
export async function callAdminForthApi({ path, method, body=undefined, headers=undefined }: {
74+
export async function callAdminForthApi({ path, method, body=undefined, headers=undefined, silentError = false }: {
7575
path: string,
7676
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH',
7777
body?: any,
78-
headers?: Record<string, string>
78+
headers?: Record<string, string>,
79+
silentError?: boolean
7980
}): Promise<any> {
8081
try {
81-
return callApi({path: `/adminapi/v1${path}`, method, body} );
82+
return callApi({path: `/adminapi/v1${path}`, method, body, headers, silentError} );
8283
} catch (e) {
8384
console.error('error', e);
8485
return { error: `Unexpected error: ${e}` };

0 commit comments

Comments
 (0)