post review fixes

This commit is contained in:
Krzysztof Dukszta-Kwiatkowski
2023-05-25 15:13:21 +02:00
committed by Ali BARIN
parent 3f8f022d48
commit 6e80ff4eb6
37 changed files with 94 additions and 75 deletions

View File

@@ -1,11 +1,8 @@
import { TBeforeRequest } from '@automatisch/types';
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
if ($.auth.data.oInstanceUrl) {
requestConfig.baseURL = $.auth.data.oInstanceUrl as string;
}
if (requestConfig.headers && $.auth.data?.accessToken) {
if ($.auth.data?.accessToken) {
requestConfig.headers = requestConfig.headers || {};
requestConfig.headers.Authorization = `Bearer ${$.auth.data.accessToken}`;
}
return requestConfig;