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