We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1c92c17 commit 218fc29Copy full SHA for 218fc29
adminforth/spa/src/utils.ts
@@ -13,15 +13,17 @@ const LS_LANG_KEY = `afLanguage`;
13
const MAX_CONSECUTIVE_EMPTY_RESULTS = 2;
14
const ITEMS_PER_PAGE_LIMIT = 100;
15
16
-export async function callApi({path, method, body=undefined}: {
+export async function callApi({path, method, body, headers}: {
17
path: string, method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'
18
body?: any
19
+ headers?: Record<string, string>
20
}): Promise<any> {
21
const options = {
22
method,
23
headers: {
24
'Content-Type': 'application/json',
25
'accept-language': localStorage.getItem(LS_LANG_KEY) || 'en',
26
+ ...headers
27
},
28
body: JSON.stringify(body),
29
};
0 commit comments