Advertisement
Guest User

Untitled

a guest
Oct 13th, 2019
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. ajax({
  2. type: 'POST',
  3. url: '/Account/Login',
  4. data: JSON.stringify({ email: this.email, password: this.password })
  5. }).done(function (data) {
  6. var json = JSON.parse(data);
  7.  
  8. if (json.success) {
  9. login.set("jwt", JSON.parse(data).jwt);
  10.  
  11. $.ajaxSetup({
  12. beforeSend: function (xhr) {
  13. xhr.setRequestHeader("Authorization","Bearer " + login.jwt);
  14. }
  15. });
  16.  
  17. $.cookie('JwtBearer', login.jwt, { expires: 7, path: '/' });
  18.  
  19. app.navigate("/Home/Calendar");
  20. }
  21. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement