function updateCaptions()

in source/web/js/app.js [177:217]


function updateCaptions(
  videoId,
  captionIndex,
  text,
  wordLength,
  language,
  type,
  translated
) {
  var api = siteConfig.api_base + siteConfig.api_captions + "/" + videoId;
  console.log("[INFO] updating captions: " + api);
  let axiosConfig = {
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
      "X-Api-Key": localStorage.apiKey,
    },
  };
  axios
    .put(
      api,
      {
        captionIndex: captionIndex,
        text: text,
        wordLength: wordLength,
        language: language,
        type: type,
        translated: translated,
      },
      axiosConfig
    )
    .then(function (response) {
      console.log("[INFO] successfully saved captions");
      toastr.success("Saved captions");
    })
    .catch(function (error) {
      console.log('[ERROR] error while saving captions" ' + error);
      toastr.error("Failed to save captions");
    });

  return true;
}