mirror of
https://github.com/vale981/Vulcan
synced 2025-03-10 12:36:39 -04:00
20 lines
543 B
JavaScript
20 lines
543 B
JavaScript
![]() |
import { GraphQLSchema } from 'meteor/nova:core';
|
||
|
// import Events from './collection.js';
|
||
|
import { requestAnalyticsAsync } from './helpers.js';
|
||
|
|
||
|
GraphQLSchema.addMutation('eventTrack(eventName: String, properties: JSON): JSON');
|
||
|
|
||
|
const resolvers = {
|
||
|
Mutation: {
|
||
|
eventTrack: (root, { eventName, properties }, context) => {
|
||
|
const user = context.currentUser || {_id: 'anonymous'};
|
||
|
|
||
|
requestAnalyticsAsync(eventName, properties, user);
|
||
|
|
||
|
return properties;
|
||
|
},
|
||
|
},
|
||
|
};
|
||
|
|
||
|
GraphQLSchema.addResolvers(resolvers);
|