feat(invoice-ninja): add invoice ninja integration

This commit is contained in:
Rıdvan Akca
2023-10-05 18:00:51 +03:00
parent 1369bb095f
commit ee6c9fa5d4
10 changed files with 122 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
import { TBeforeRequest } from '@automatisch/types';
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
const { instanceUrl } = $.auth.data;
if (instanceUrl) {
requestConfig.baseURL = instanceUrl as string;
}
requestConfig.headers['X-API-TOKEN'] = $.auth.data.apiToken as string;
requestConfig.headers['X-Requested-With'] = 'XMLHttpRequest';
requestConfig.headers['Content-Type'] =
requestConfig.headers['Content-Type'] || 'application/json';
return requestConfig;
};
export default addAuthHeader;