w_set.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. "use strict";
  2. function w_set_reset() {
  3. let lang_data = new FormData();
  4. lang_data.append('data', 'reset end authority_error');
  5. fetch('/api/v2/lang', {
  6. method : 'POST',
  7. body : lang_data,
  8. }).then(function(res) {
  9. return res.json();
  10. }).then(function(lang) {
  11. lang = lang["data"];
  12. let check = confirm(lang['reset']);
  13. if(check === true) {
  14. const url = window.location.pathname;
  15. const url_split = url.split('/');
  16. let doc_name = url_split.slice(2, undefined).join('/');
  17. fetch('/api/v2/set_reset/' + doc_name).then(function(res) {
  18. return res.json();
  19. }).then(function(data) {
  20. if(data) {
  21. if(data["response"] === "require auth") {
  22. alert(lang["authority_error"]);
  23. } else {
  24. alert(lang['end']);
  25. }
  26. history.go(0);
  27. }
  28. });
  29. }
  30. });
  31. }