refactor: Pass connection, flow and step as params to apps

This commit is contained in:
Faruk AYDIN
2022-08-21 20:25:04 +03:00
parent cd6c5216ff
commit 44e3de8534
18 changed files with 60 additions and 85 deletions

View File

@@ -1,4 +1,4 @@
import type { IAuthentication, IField } from '@automatisch/types';
import type { IAuthentication, IField, IApp } from '@automatisch/types';
import { URLSearchParams } from 'url';
import TwitterClient from './client';
@@ -10,7 +10,7 @@ export default class Authentication implements IAuthentication {
}
async createAuthData() {
const appFields = this.client.appData.fields.find(
const appFields = this.client.connection.appData.fields.find(
(field: IField) => field.key == 'oAuthRedirectUrl'
);
const callbackUrl = appFields.value;
@@ -30,8 +30,9 @@ export default class Authentication implements IAuthentication {
const responseData = Object.fromEntries(new URLSearchParams(response.data));
return {
consumerKey: this.client.connectionData.consumerKey,
consumerSecret: this.client.connectionData.consumerSecret,
consumerKey: this.client.connection.formattedData.consumerKey as string,
consumerSecret: this.client.connection.formattedData
.consumerSecret as string,
accessToken: responseData.oauth_token,
accessSecret: responseData.oauth_token_secret,
userId: responseData.user_id,