fix: Make generate request method generic for all requests of twitter
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { Token } from 'oauth-1.0a';
|
import { Token } from 'oauth-1.0a';
|
||||||
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||||
import oauthClient from './oauth-client';
|
import oauthClient from './oauth-client';
|
||||||
|
import { Method } from 'axios';
|
||||||
|
|
||||||
type IGenereateRequestOptons = {
|
type IGenereateRequestOptons = {
|
||||||
requestPath: string;
|
requestPath: string;
|
||||||
@@ -29,8 +30,12 @@ const generateRequest = async (
|
|||||||
oauthClient($).authorize(requestData, token)
|
oauthClient($).authorize(requestData, token)
|
||||||
);
|
);
|
||||||
|
|
||||||
const response = await $.http.post(`/oauth/request_token`, null, {
|
const response = await $.http.request({
|
||||||
headers: { ...authHeader },
|
url: requestData.url,
|
||||||
|
method: requestData.method as Method,
|
||||||
|
headers: {
|
||||||
|
...authHeader,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
Reference in New Issue
Block a user