Advertisement
afterlife88

Untitled

Oct 24th, 2015
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     var initStyle = function () {
  2.         if (localStorage['user']) {
  3.             var fromLocal = JSON.parse(localStorage['user']);
  4.             var idUser = fromLocal.idUser;
  5.             var hash = CryptoJS.HmacSHA1(fromLocal.idUser + fromLocal.secret, fromLocal.secret.toString()).toString();
  6.             delete hash.access_token;
  7.             $.ajax({
  8.                 type: 'GET',
  9.                 url: 'http://localhost:1711/api/css/getStyle',
  10.                // data: sendData,
  11.                // dataType: "html",
  12.                 headers: { 'AuthorId': idUser, 'hash': hash },
  13.                 beforeSend: function (xhr) {
  14.                     var token = fromLocal.secret;
  15.                     xhr.setRequestHeader("Authorization", "Bearer " + token);
  16.                 },
  17.                 statusCode: {
  18.                     200: function (data) {
  19.                         //alert(data);
  20.                         return JSON.parse(data);
  21.                     },
  22.                     404: function () {
  23.                         return false;
  24.                     }
  25.                 }
  26.             });
  27.         }
  28.     };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement