Christian Matheus Batista Macedo преди 6 години
родител
ревизия
9aa5af831d
променени са 1 файла, в които са добавени 14 реда и са изтрити 10 реда
  1. 14 10
      js/functions.js

+ 14 - 10
js/functions.js

@@ -9,14 +9,16 @@ var mktSuite = (function(){
9 9
     $.ajax({
10 10
         xhr: function() {
11 11
             var xhr = new window.XMLHttpRequest();
12
+            if(process) {
13
+              xhr.upload.addEventListener("progress", function(evt) {
14
+                  if (evt.lengthComputable) {
15
+                      var percentComplete = evt.loaded / evt.total;
16
+                      percentComplete = parseInt(percentComplete * 100);
17
+                      process(percentComplete)
18
+                  }
19
+              }, false);
20
+            }
12 21
 
13
-            xhr.upload.addEventListener("progress", function(evt) {
14
-                if (evt.lengthComputable) {
15
-                    var percentComplete = evt.loaded / evt.total;
16
-                    percentComplete = parseInt(percentComplete * 100);
17
-                    process(percentComplete)
18
-                }
19
-            }, false);
20 22
 
21 23
             return xhr;
22 24
         },
@@ -38,7 +40,7 @@ var mktSuite = (function(){
38 40
 
39 41
   var accounts = null
40 42
 
41
-  actions.authenticantion = function() {
43
+  actions.authentication = function() {
42 44
     call('GET', '/account', null, function (data) {
43 45
       console.log(data);
44 46
       accounts = data.accounts;
@@ -53,7 +55,9 @@ var mktSuite = (function(){
53 55
 
54 56
   actions.validation = function (account) {
55 57
     var token = account.token
56
-    console.log(token);
58
+    call('POST', '/account/auth', {"account" : token}, function () {
59
+
60
+    })
57 61
 
58 62
   }
59 63
 
@@ -61,4 +65,4 @@ var mktSuite = (function(){
61 65
 
62 66
 })();
63 67
 
64
-mktSuite.authenticantion()
68
+mktSuite.authentication()