TpdsQueueManager.js 537 B

12345678910111213141516171819202122232425
  1. const Settings = require('@overleaf/settings')
  2. const OError = require('@overleaf/o-error')
  3. const fetch = require('node-fetch')
  4. async function getQueues(userId) {
  5. const response = await fetch(
  6. `${Settings.apis.tpdsworker.url}/queues/${userId}`,
  7. {
  8. headers: {
  9. Accept: 'application/json',
  10. },
  11. }
  12. )
  13. if (!response.ok) {
  14. throw new OError('failed to query TPDS queues for user', { userId })
  15. }
  16. const body = await response.json()
  17. return body
  18. }
  19. module.exports = {
  20. promises: {
  21. getQueues,
  22. },
  23. }