feat: add defineApp and beforeRequest
This commit is contained in:
11
packages/backend/src/apps/github/common/add-auth-header.ts
Normal file
11
packages/backend/src/apps/github/common/add-auth-header.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { TBeforeRequest } from "@automatisch/types";
|
||||
|
||||
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||
if (requestConfig.headers && $.auth.data?.accessToken) {
|
||||
requestConfig.headers.Authorization = `Bearer ${$.auth.data.accessToken}`
|
||||
}
|
||||
|
||||
return requestConfig;
|
||||
}
|
||||
|
||||
export default addAuthHeader;
|
@@ -1,4 +1,7 @@
|
||||
export default {
|
||||
import defineApp from '../../helpers/define-app';
|
||||
import addAuthHeader from './common/add-auth-header';
|
||||
|
||||
export default defineApp({
|
||||
name: 'Github',
|
||||
key: 'github',
|
||||
baseUrl: 'https://github.com',
|
||||
@@ -7,4 +10,5 @@ export default {
|
||||
authDocUrl: 'https://automatisch.io/docs/connections/github',
|
||||
primaryColor: '000000',
|
||||
supportsConnections: true,
|
||||
};
|
||||
beforeRequest: [addAuthHeader],
|
||||
});
|
||||
|
Reference in New Issue
Block a user