feat(trello): add trello integration (#1380)
This commit is contained in:
11
packages/backend/src/apps/trello/common/add-auth-header.ts
Normal file
11
packages/backend/src/apps/trello/common/add-auth-header.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { TBeforeRequest } from '@automatisch/types';
|
||||
|
||||
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||
if ($.auth.data?.token) {
|
||||
requestConfig.headers.Authorization = `OAuth oauth_consumer_key="${$.auth.data.apiKey}", oauth_token="${$.auth.data.token}"`;
|
||||
}
|
||||
|
||||
return requestConfig;
|
||||
};
|
||||
|
||||
export default addAuthHeader;
|
||||
3
packages/backend/src/apps/trello/common/auth-scope.ts
Normal file
3
packages/backend/src/apps/trello/common/auth-scope.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
const authScope: string[] = ['read', 'write', 'account'];
|
||||
|
||||
export default authScope;
|
||||
10
packages/backend/src/apps/trello/common/get-current-user.ts
Normal file
10
packages/backend/src/apps/trello/common/get-current-user.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||
|
||||
const getCurrentUser = async ($: IGlobalVariable): Promise<IJSONObject> => {
|
||||
const response = await $.http.get('/1/members/me/');
|
||||
const currentUser = response.data;
|
||||
|
||||
return currentUser;
|
||||
};
|
||||
|
||||
export default getCurrentUser;
|
||||
Reference in New Issue
Block a user