feat: Convert all app files to JS

This commit is contained in:
Faruk AYDIN
2024-01-05 17:44:21 +01:00
parent b95478b635
commit 43dba351c3
1030 changed files with 5114 additions and 6436 deletions

View File

@@ -1,7 +1,6 @@
import { TBeforeRequest } from '@automatisch/types';
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
if (requestConfig.additionalProperties?.skipAddingAuthHeader) return requestConfig;
const addAuthHeader = ($, requestConfig) => {
if (requestConfig.additionalProperties?.skipAddingAuthHeader)
return requestConfig;
if ($.auth.data?.accessToken) {
const authorizationHeader = `Bearer ${$.auth.data.accessToken}`;

View File

@@ -1,6 +1,4 @@
import { TBeforeRequest } from '@automatisch/types';
const addNotionVersionHeader: TBeforeRequest = ($, requestConfig) => {
const addNotionVersionHeader = ($, requestConfig) => {
requestConfig.headers['Notion-Version'] = '2022-06-28';
return requestConfig;

View File

@@ -0,0 +1,9 @@
const getCurrentUser = async ($) => {
const userId = $.auth.data.owner.user.id;
const response = await $.http.get(`/v1/users/${userId}`);
const currentUser = response.data;
return currentUser;
};
export default getCurrentUser;

View File

@@ -1,17 +0,0 @@
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
type Owner = {
user: {
id: string
}
}
const getCurrentUser = async ($: IGlobalVariable): Promise<IJSONObject> => {
const userId = ($.auth.data.owner as Owner).user.id;
const response = await $.http.get(`/v1/users/${userId}`);
const currentUser = response.data;
return currentUser;
};
export default getCurrentUser;