13 lines
365 B
TypeScript
13 lines
365 B
TypeScript
import { TBeforeRequest } from '@automatisch/types';
|
|
|
|
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
|
if ($.auth.data?.authenticationKey) {
|
|
const authorizationHeader = `DeepL-Auth-Key ${$.auth.data.authenticationKey}`;
|
|
requestConfig.headers.Authorization = authorizationHeader;
|
|
}
|
|
|
|
return requestConfig;
|
|
};
|
|
|
|
export default addAuthHeader;
|