Numtel Mysql Server Method Returns

I am working on an React/numtel:mysql app that sends a batch of IDs to the server to run a query on.

While the server is processing the request, I want to block the user from submitting further changes as I have had a few instances where things didn’t occur right away resulting in multiple submissions to the app (this segment is for timesheets which turn into billing, so that is less than ideal :slight_smile:). I know how to deactivate/hide the buttons that make the submission but I’m coming up short on how I can conceptually know that the server is truly finished.

A sample client call is:

`_stopTimer () { let timer = this.props.timer;'timer.stop', timer.TimerID); }`

And the current server method is:

`'timer.stop'(timerId) { check(timerId, Number); if (!Meteor.userId()) { throw new Meteor.Error('not-authorized'); } var ltId = userData(Meteor.userId()).userMap.ltId; var query = 'UPDATE timers SET Minutes=(CEIL((TIMESTAMPDIFF(SECOND,timers.TimerStart,NOW())*10/60)/10)+timers.minutes), Running=0 WHERE TimerID = ${timerId} AND running = 1'; var query2 = 'INSERT INTO h_users (UserID, Message, HistoryDate, ID, AuditAction) VALUES (${ltId}, 'Stopped timer #${timerId}.', NOW(), ${timerId},105)'; liveDb.db.query(query); liveDb.db.query(query2); }`

Note: I replaced the backticks around my queries with single quotes for formatting purposes.

1 Like