Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Commit

Permalink
Update jQuery ajax header Authorization setting (#790)
Browse files Browse the repository at this point in the history
* Update jQuery ajax header Authorization setting

* Style fix

* Update token_handler.blade.php

Avoid overwrite any existing custom headers

* Use template style setting for jQuery.ajaxSetup

* Update token_handler.blade.php

Use window.jQuery.ajaxSettings.headers = { } instead of ajaxSetup method
  • Loading branch information
thang12l committed Jun 22, 2021
1 parent 2789c40 commit d3df995
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -23,7 +23,11 @@
if (window.jQuery) {
// jQuery
window.jQuery.ajaxSettings.headers['Authorization'] = `Bearer ${window.sessionToken}`;
if (window.jQuery.ajaxSettings.headers) {
window.jQuery.ajaxSettings.headers['Authorization'] = `Bearer ${window.sessionToken}`;
} else {
window.jQuery.ajaxSettings.headers = { 'Authorization': `Bearer ${window.sessionToken}`};
}
}
if (window.axios) {
Expand Down

0 comments on commit d3df995

Please sign in to comment.