wenhongquan 3 years ago
parent
commit
f785926e56
1 changed files with 12 additions and 12 deletions
  1. 12 12
      public/login.js

+ 12 - 12
public/login.js

@@ -43,22 +43,22 @@ Package.prototype = {
         let _t = this;
         if (localStorage.getItem("token")) {
             $.ajax({
-                type: "PUT",
-                url: this.settings.URL + "/videoService/accounts/token/keepalive",
-                contentType: "application/json", //如果提交的是json数据类型,则必须有此参数,表示提交的数据类型
-                dateType: "json",
+                type: 'PUT',
+                url: this.settings.URL + '/videoService/accounts/token/keepalive',
+                contentType: 'application/json', //如果提交的是json数据类型,则必须有此参数,表示提交的数据类型
+                dateType: 'json',
                 data: JSON.stringify({
-                    token: localStorage.getItem("token"),
-                    duration: 120,
+                    token: localStorage.getItem('token'),
+                    duration: 86400,
                 }),
                 beforeSend: function(xhr) {
                     xhr.setRequestHeader(
-                        "X-Subject-Token",
-                        localStorage.getItem("token")
+                        'X-Subject-Token',
+                        localStorage.getItem('token'),
                     );
                     xhr.setRequestHeader(
-                        "Content-Type",
-                        "application/json;charset=UTF-8"
+                        'Content-Type',
+                        'application/json;charset=UTF-8',
                     );
                 },
                 success: function(jsonResult) {
@@ -67,8 +67,8 @@ Package.prototype = {
                     // }, 20000);
                 },
                 error: function(data) {
-                    localStorage.removeItem("token")
-                    _t.login()
+                    localStorage.removeItem('token');
+                    _t.login();
                 },
             });
         } else {