refactor: clean up github and rewrite its auth

This commit is contained in:
Ali BARIN
2022-10-16 19:49:45 +02:00
parent a69cd51dda
commit 314787f39c
37 changed files with 398 additions and 1756 deletions

View File

@@ -0,0 +1,28 @@
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
import { Method } from 'axios';
type IGenereateRequestOptons = {
requestPath: string;
method: string;
data?: IJSONObject;
};
const generateRequest = async (
$: IGlobalVariable,
options: IGenereateRequestOptons
) => {
const { requestPath, method, data } = options;
const response = await $.http.request({
url: requestPath,
method: method as Method,
data,
headers: {
Authorization: `Bearer ${$.auth.data.accessToken}`
},
});
return response;
};
export default generateRequest;