fix: Type problems regarding global variable
This commit is contained in:
31
packages/backend/src/helpers/global-variable.ts
Normal file
31
packages/backend/src/helpers/global-variable.ts
Normal 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;
|
Reference in New Issue
Block a user