15 lines
401 B
TypeScript
15 lines
401 B
TypeScript
import { TBeforeRequest } from '@automatisch/types';
|
|
|
|
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
|
if (requestConfig.additionalProperties?.skipAddingAuthHeader)
|
|
return requestConfig;
|
|
|
|
if ($.auth.data?.accessToken) {
|
|
requestConfig.headers.Authorization = `${$.auth.data.tokenType} ${$.auth.data.accessToken}`;
|
|
}
|
|
|
|
return requestConfig;
|
|
};
|
|
|
|
export default addAuthHeader;
|