многократные сообщения axios, подписываются на events.watch - PullRequest
0 голосов
/ 18 февраля 2019

Я пытаюсь просмотреть события из нескольких календарей, как описано здесь:

https://developers.google.com/calendar/v3/reference/events/watch

У меня около 50 календарей, которые мне нужно посмотреть, я использую axios.all - какя могу хранить ответ от каждого сообщения?

axios.all([
  axios.post('https://www.googleapis.com/calendar/v3/calendars/xxx/events/watch',
 {
      type: "web_hook",
      address: "https:/rguc-calendars.firebaseapp.com/notifications"
    },
    {
      "Content-Type": "application/json;charset=UTF-8",
      Authorization: tokens.token_type + " " + tokens.access_token
    }

    ),
  axios.post('https://www.googleapis.com/calendar/v3/calendars/xxx/events/watch',
     {
      type: "web_hook",
      address: "https:/rguc-calendars.firebaseapp.com/notifications"
    },
    {
      "Content-Type": "application/json;charset=UTF-8",
      Authorization: tokens.token_type + " " + tokens.access_token
    }

    ),
  axios.post('https://www.googleapis.com/calendar/v3/calendars/xxx/events/watch',
     {
      type: "web_hook",
      address: "https:/rguc-calendars.firebaseapp.com/notifications"
    },
    {
      "Content-Type": "application/json;charset=UTF-8",
      Authorization: tokens.token_type + " " + tokens.access_token
    })
  axios.post('https://www.googleapis.com/calendar/v3/calendars/xxxm/events/watch',
     {
      type: "web_hook",
      address: "https:/rguc-calendars.firebaseapp.com/notifications"
    },
    {
      "Content-Type": "application/json;charset=UTF-8",
      Authorization: tokens.token_type + " " + tokens.access_token
    })
....etc
     ])
      .then(axios.spread(function (acct, perms) {
     console.log("subscribed to all event watches")
      }));
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...