How to use the meteor/meteor.Meteor.call function in meteor

To help you get started, we’ve selected a few meteor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nrkno / tv-automation-server-core / meteor / client / ui / Settings / Migration.tsx View on Github external
forceMigration () {
		this.setErrorMessage('')
		if (this.state.migration) {
			Meteor.call(MigrationMethods.forceMigration,
				this.state.migration.chunks,
			(err) => {
				if (this.cancelRequests) return
				if (err) {
					logger.error(err)
					// todo: notify user
					this.setErrorMessage(err)
				} else {
					this.setState({
						migrationCompleted: true,
						haveRunMigration: true
					})

					this.updateVersions()
				}
			})
github reactioncommerce / reaction / imports / plugins / core / accounts / client / components / adminInviteForm.js View on Github external
  sendInvitation = (options) => Meteor.call("accounts/inviteShopMember", options, (error, result) => {
    if (error) {
      let messageKey;
      // switching to use of package i18n keys (groupsInvite. namespace)
      if (error.reason === "Unable to send invitation email.") {
        messageKey = "admin.groupsInvite.unableToSendInvitationEmail";
      } else if (error.reason === "cannot directly invite owner") {
        messageKey = "admin.groupsInvite.inviteOwnerError";
      } else if (error.reason === "cannot invite to group") {
        messageKey = "admin.groupsInvite.cannotInvite";
      } else if (error.reason === "Need to set a username or email") {
        messageKey = "admin.groupsInvite.NeedToSetUsernameOrEmail";
      } else {
        messageKey = "admin.groupsInvite.errorSendingInvite";
      }

      const { alertId } = this.state;
github apinf / platform / apinf_packages / settings / server / methods.js View on Github external
updateMailConfiguration () {
    // Try if settings exist
    try {
      // Get Settings collection
      const settings = Settings.findOne();

      // Enable/disable accounts email features based on email configuration
      if (settings.mail.enabled) {
        // Configure system SMTP variable for sending mail
        Meteor.call('configureSmtpSettings', settings);

        // Enable accounts email related features (validation, reset password)
        Meteor.call('enableAccountEmailSettings');
      } else {
        // No email verification or reset password functionality
        Meteor.call('disableAccountEmailSettings');
      }
    } catch (error) {
      // otherwise preapare message about error
      const message = `Update mail configuration: ${error}`;

      // Show an error message
      throw new Meteor.Error(message);
    }
  },
});
github CommonGarden / Grow-IoT / imports / api / thing / server-methods.js View on Github external
if (dataPoint.fields) {
        influx.writePoints([
          dataPoint
        ]).catch(err => {
          if (err.message !== 'No host available') {
            if (err.errno !== 'ECONNREFUSED') console.error(`Error saving data to InfluxDB! ${err.stack}`);
          }
        });
      }
    }

    if (event.type === 'alert') {
      let key = _.keys(event.message)[0];
      let notification = 'Alert: ' + key + ' ' + event.message[key];
      Meteor.call('Notifications.new',
        notification,
        thing.owner,
        (error, document) => {
          if (error) {
            console.error('New notification error', error);
          }
        }
      );
    }

    return !!Events.insert({
      thing: {
        _id: thing._id
      },
      event: event,
      insertedAt: new Date()
github catsass19 / Sapporo / imports / ui / admin / liveFeed.jsx View on Github external
deleteFeed () {
        Meteor.call('liveFeed.delete', this.state.clickFeed, function (err) {
            if (err) {
                alert(err);
            }
        });
        this.closeFeed();
    }
    render () {
github RocketChat / Rocket.Chat / app / ui-flextab / client / tabs / userActions.js View on Github external
action: prevent(getUser, ({ _id, username }) => {
					const userModerator = RoomRoles.findOne({ rid: Session.get('openedRoom'), 'u._id': _id, roles: 'moderator' }, { fields: { _id: 1 } });
					if (userModerator != null) {
						return;
					}
					Meteor.call('addRoomModerator', Session.get('openedRoom'), _id, success(() => {
						const room = ChatRoom.findOne(Session.get('openedRoom'));
						toastr.success(TAPi18n.__('User__username__is_now_a_moderator_of__room_name_', { username, room_name: room.name }));
					}));
				}),
			};
github reactioncommerce / reaction / imports / plugins / core / ui / client / containers / mediaGallery.js View on Github external
.then(() => {
            Meteor.call("media/insert", fileRecord.document, (error) => {
              if (error) Alerts.toast(error.reason, "error");
              this.setState({ uploadProgress: null });
            });
            return null;
          })
          .catch((error) => {
github RocketChat / Rocket.Chat / packages / rocketchat-ui-account / client / accountIntegrations.js View on Github external
'click .webdav-account-remove'(e) {
		e.preventDefault();
		const selectEl = document.getElementById('webdav-accounts');
		const { options } = selectEl;
		const selectedOption = selectEl.value;
		const optionIndex = Array.from(options).findIndex((option) => option.value === selectedOption);

		Meteor.call('removeWebdavAccount', selectedOption, function(error) {
			if (error) {
				return toastr.error(t(error.error));
			}

			toastr.success(t('webdav-account-removed'));
			modal.close();
		});

		selectEl.remove(optionIndex);
	},
});
github thm-projects / arsnova-flashcards / imports / ui / filter / index / item / shuffleRepetitoriumCallout.js View on Github external
'click #updateShuffledCardset': function () {
		let removedCardsets = $(Cardsets.findOne({_id: Router.current().params._id}).cardGroups).not(Session.get("ShuffledCardsets")).get();
		Meteor.call("updateShuffleGroups", Router.current().params._id, Session.get("ShuffledCardsets"), removedCardsets, function (error, result) {
			if (error) {
				BertAlertVisuals.displayBertAlert(TAPi18n.__('set-list.shuffleUpdateFailure'), 'danger', 'growl-top-left');
			}
			if (result) {
				Session.set('activeCard', undefined);
				BertAlertVisuals.displayBertAlert(TAPi18n.__('set-list.shuffleUpdateSuccess'), 'success', 'growl-top-left');
				Router.go('cardsetdetailsid', {_id: Router.current().params._id});
			}
		});
	},
	'click #cancelUpdateShuffle': function () {
github erxes / erxes / imports / react-ui / layout / containers / Notifications / NotificationList.js View on Github external
const markAsRead = (ids, callback) => {
    Meteor.call('notifications.markAsRead', ids, callback);
  };