root 4 éve
szülő
commit
cf7525a522
1 módosított fájl, 7 hozzáadás és 7 törlés
  1. 7 7
      index.js

+ 7 - 7
index.js

@@ -475,8 +475,8 @@ window.onload = function () {
 
   $("#button_save_cloud").click(() => {
     var code = Ardublockly.generateXml();
-    var title = $("#sketch_name").val() != ''?$("#sketch_name").val() :'未命名';
-    savelxfile(code,title,showSaveToast);
+    var title = $("#sketch_name").val() != '' ? $("#sketch_name").val() : '未命名';
+    savelxfile(code, title, showSaveToast);
   })
 }
 
@@ -1450,7 +1450,7 @@ function savelxfile(code, title, cb) {
   if (_token) {
     $.ajax(`/api/web/v1/blockpy/project/add`, {
       type: "POST",
-      headers: { 'X-Oauth-Token': _token, 'content-type': "application/json;charset=UTF-8" },
+      headers: { 'Authorization': "Bearer " + _token, 'content-type': "application/json;charset=UTF-8" },
       data: { code: code, title: title },
       success: (data) => {
         cb(data)
@@ -1464,7 +1464,7 @@ function getlxfiles(page, cb) {
   if (_token) {
     $.ajax(`/api/web/v1/blockpy/project/list`, {
       type: "GET",
-      headers: { 'X-Oauth-Token': _token },
+      headers: { 'Authorization': "Bearer " + _token },
       data: "pageNumber=" + page + "pageSize=20",
       success: (data) => {
         cb(data)
@@ -1479,7 +1479,7 @@ function getlxfilebyid(id) {
   if (_token) {
     $.ajax(`/api/web/v1/blockpy/project/` + id, {
       type: "GET",
-      headers: { 'X-Oauth-Token': _token },
+      headers: { 'Authorization': "Bearer " + _token  },
       success: (data) => {
         cb(data)
       }
@@ -1487,8 +1487,8 @@ function getlxfilebyid(id) {
   }
 }
 
-function showSaveToast(data){
+function showSaveToast(data) {
   setTimeout(function () {
-    Materialize.toast(data.success?'保存成功':'保存失败', 3000, "shareUrl")
+    Materialize.toast(data.success ? '保存成功' : '保存失败', 3000, "shareUrl")
   }, getCurrentDate())
 }