Cleanup the api_key and csrf_token setters

This commit is contained in:
Nabeel Shahzad
2018-03-13 01:55:14 -05:00
parent 684ee545cf
commit 57cddee3fd
4 changed files with 33 additions and 16 deletions

View File

@@ -3,6 +3,7 @@
function setEditable() {
const token = $('meta[name="csrf-token"]').attr('content');
const api_key = $('meta[name="api-key"]').attr('content');
@if(isset($aircraft))
$('#expenses a.text').editable({
@@ -12,7 +13,7 @@ function setEditable() {
ajaxOptions: {
type: 'post',
headers: {
'x-api-key': '{{ Auth::user()->api_key }}',
'x-api-key': api_key,
'X-CSRF-TOKEN': token,
}
},
@@ -35,7 +36,7 @@ function setEditable() {
ajaxOptions: {
type: 'post',
headers: {
'x-api-key': '{{ Auth::user()->api_key }}',
'x-api-key': api_key,
'X-CSRF-TOKEN': token,
}
},