feat(flowers-software): add app with authentication

This commit is contained in:
Ali BARIN
2022-12-15 00:46:42 +01:00
parent f30ac46672
commit 7175d92eaf
8 changed files with 124 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
import { TBeforeRequest } from '@automatisch/types';
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
const { data } = $.auth;
if (data?.username && data.password && data.apiKey) {
requestConfig.headers['x-api-key'] = data.apiKey as string;
requestConfig.auth = {
username: data.username as string,
password: data.password as string,
};
}
return requestConfig;
};
export default addAuthHeader;