Skip to content

Commit

Permalink
Removes protolib dependency in protolib/api
Browse files Browse the repository at this point in the history
  • Loading branch information
jcarlosn committed Jul 6, 2024
1 parent 5959041 commit d039668
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/protolib/src/api/lib/generateApi.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { generateEvent } from "../../bundles/events/eventsLibrary";
import { getServiceToken } from './serviceToken'
import { handler } from './handler'
import { API, getEnv, getLogger } from 'protobase';
Expand All @@ -21,6 +20,14 @@ const logger = getLogger()
single: most apis are used to expose a list of things. Single means a single entity, not a list of things. So /api/v1/test returns the entity, not a list of things
*/

const generateEvent = async (event, token='') => {
try {
await API.post('/adminapi/v1/events?token='+token, event, undefined, true)
} catch(e) {
//console.error("Failed to send event: ", e)
}
}

type AutoAPIOptions = {
modelName: string,
modelType: any,
Expand Down

0 comments on commit d039668

Please sign in to comment.