Files
automatisch/packages/backend/src/apps/openai/common/add-auth-header.ts
2023-01-18 22:41:34 +01:00

12 lines
282 B
TypeScript

import { TBeforeRequest } from '@automatisch/types';
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
if ($.auth.data?.apiKey) {
requestConfig.headers.Authorization = `Bearer ${$.auth.data.apiKey}`;
}
return requestConfig;
};
export default addAuthHeader;