fix: Type problems regarding global variable

This commit is contained in:
Faruk AYDIN
2022-10-06 00:49:24 +03:00
parent 8308265a62
commit 63ffd1f720
7 changed files with 21 additions and 24 deletions

View File

@@ -0,0 +1,31 @@
import createHttpClient from './http-client';
import Connection from '../models/connection';
import Flow from '../models/flow';
import { IJSONObject, IApp, IGlobalVariable } from '@automatisch/types';
const globalVariable = (
connection: Connection,
appData: IApp,
flow?: Flow
): IGlobalVariable => {
return {
auth: {
set: async (args: IJSONObject) => {
return await connection.$query().patchAndFetch({
formattedData: {
...connection.formattedData,
...args,
},
});
},
data: connection.formattedData,
},
app: appData,
http: createHttpClient({ baseURL: appData.baseUrl }),
db: {
flow: flow,
},
};
};
export default globalVariable;