feat: Convert all app files to JS
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import { TBeforeRequest } from '@automatisch/types';
|
||||
|
||||
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||
const addAuthHeader = ($, requestConfig) => {
|
||||
if (requestConfig.headers && $.auth.data?.accessToken) {
|
||||
requestConfig.headers.Authorization = `Bearer ${$.auth.data.accessToken}`;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
const getCurrentUser = async ($) => {
|
||||
const response = await $.http.get('/user');
|
||||
|
||||
const currentUser = response.data;
|
||||
return currentUser;
|
||||
};
|
||||
|
||||
export default getCurrentUser;
|
||||
@@ -1,10 +0,0 @@
|
||||
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||
|
||||
const getCurrentUser = async ($: IGlobalVariable): Promise<IJSONObject> => {
|
||||
const response = await $.http.get('/user');
|
||||
|
||||
const currentUser = response.data;
|
||||
return currentUser;
|
||||
};
|
||||
|
||||
export default getCurrentUser;
|
||||
@@ -0,0 +1,10 @@
|
||||
export default function getRepoOwnerAndRepo(repoFullName) {
|
||||
if (!repoFullName) return {};
|
||||
|
||||
const [repoOwner, repo] = repoFullName.split('/');
|
||||
|
||||
return {
|
||||
repoOwner,
|
||||
repo,
|
||||
};
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
type TRepoOwnerAndRepo = {
|
||||
repoOwner?: string;
|
||||
repo?: string;
|
||||
};
|
||||
|
||||
export default function getRepoOwnerAndRepo(
|
||||
repoFullName: string
|
||||
): TRepoOwnerAndRepo {
|
||||
if (!repoFullName) return {};
|
||||
|
||||
const [repoOwner, repo] = repoFullName.split('/');
|
||||
|
||||
return {
|
||||
repoOwner,
|
||||
repo,
|
||||
};
|
||||
}
|
||||
@@ -1,18 +1,8 @@
|
||||
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||
import type { AxiosResponse } from 'axios';
|
||||
import parseLinkHeader from '../../../helpers/parse-header-link';
|
||||
import parseLinkHeader from '../../../helpers/parse-header-link.js';
|
||||
|
||||
type TResponse = {
|
||||
data: IJSONObject[];
|
||||
error?: IJSONObject;
|
||||
};
|
||||
|
||||
export default async function paginateAll(
|
||||
$: IGlobalVariable,
|
||||
request: Promise<AxiosResponse>
|
||||
) {
|
||||
export default async function paginateAll($, request) {
|
||||
const response = await request;
|
||||
const aggregatedResponse: TResponse = {
|
||||
const aggregatedResponse = {
|
||||
data: [...response.data],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user