Cleanup the api_key and csrf_token setters
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
function setEditable() {
|
function setEditable() {
|
||||||
|
|
||||||
const token = $('meta[name="csrf-token"]').attr('content');
|
const token = $('meta[name="csrf-token"]').attr('content');
|
||||||
|
const api_key = $('meta[name="api-key"]').attr('content');
|
||||||
|
|
||||||
@if(isset($aircraft))
|
@if(isset($aircraft))
|
||||||
$('#expenses a.text').editable({
|
$('#expenses a.text').editable({
|
||||||
@@ -12,7 +13,7 @@ function setEditable() {
|
|||||||
ajaxOptions: {
|
ajaxOptions: {
|
||||||
type: 'post',
|
type: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
'x-api-key': '{{ Auth::user()->api_key }}',
|
'x-api-key': api_key,
|
||||||
'X-CSRF-TOKEN': token,
|
'X-CSRF-TOKEN': token,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -35,7 +36,7 @@ function setEditable() {
|
|||||||
ajaxOptions: {
|
ajaxOptions: {
|
||||||
type: 'post',
|
type: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
'x-api-key': '{{ Auth::user()->api_key }}',
|
'x-api-key': api_key,
|
||||||
'X-CSRF-TOKEN': token,
|
'X-CSRF-TOKEN': token,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
function setEditable() {
|
function setEditable() {
|
||||||
|
|
||||||
const csrf_token = $('meta[name="csrf-token"]').attr('content');
|
const csrf_token = $('meta[name="csrf-token"]').attr('content');
|
||||||
|
const api_key = $('meta[name="api-key"]').attr('content');
|
||||||
|
|
||||||
@if(isset($airport))
|
@if(isset($airport))
|
||||||
$('#airport-expenses a.text').editable({
|
$('#airport-expenses a.text').editable({
|
||||||
@@ -12,7 +13,7 @@ function setEditable() {
|
|||||||
ajaxOptions: {
|
ajaxOptions: {
|
||||||
type: 'post',
|
type: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
'x-api-key': '{{ Auth::user()->api_key }}',
|
'x-api-key': api_key,
|
||||||
'X-CSRF-TOKEN': csrf_token
|
'X-CSRF-TOKEN': csrf_token
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -35,7 +36,7 @@ function setEditable() {
|
|||||||
ajaxOptions: {
|
ajaxOptions: {
|
||||||
type: 'post',
|
type: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
'x-api-key': '{{ Auth::user()->api_key }}',
|
'x-api-key': api_key,
|
||||||
'X-CSRF-TOKEN': csrf_token
|
'X-CSRF-TOKEN': csrf_token
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -52,12 +53,16 @@ function setEditable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function phpvms_vacentral_airport_lookup(icao, callback) {
|
function phpvms_vacentral_airport_lookup(icao, callback) {
|
||||||
|
|
||||||
|
const csrf_token = $('meta[name="csrf-token"]').attr('content');
|
||||||
|
const api_key = $('meta[name="api-key"]').attr('content');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: BASE_URL + '/api/airports/'+ icao + '/lookup',
|
url: BASE_URL + '/api/airports/'+ icao + '/lookup',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
'x-api-key': '{{ Auth::user()->api_key }}',
|
'x-api-key': api_key,
|
||||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
'X-CSRF-TOKEN': csrf_token
|
||||||
}
|
}
|
||||||
}).done(function (data, status) {
|
}).done(function (data, status) {
|
||||||
callback(data.data);
|
callback(data.data);
|
||||||
@@ -66,6 +71,9 @@ function phpvms_vacentral_airport_lookup(icao, callback) {
|
|||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
const csrf_token = $('meta[name="csrf-token"]').attr('content');
|
||||||
|
const api_key = $('meta[name="api-key"]').attr('content');
|
||||||
|
|
||||||
setEditable();
|
setEditable();
|
||||||
|
|
||||||
$('#airports-table a.inline').editable({
|
$('#airports-table a.inline').editable({
|
||||||
@@ -77,8 +85,8 @@ $(document).ready(function() {
|
|||||||
ajaxOptions: {
|
ajaxOptions: {
|
||||||
type: 'post',
|
type: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
'x-api-key': '{{ Auth::user()->api_key }}',
|
'x-api-key': api_key,
|
||||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
'X-CSRF-TOKEN': csrf_token
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
params: function(params) {
|
params: function(params) {
|
||||||
|
|||||||
@@ -2,6 +2,10 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
function setEditable() {
|
function setEditable() {
|
||||||
|
|
||||||
|
const csrf_token = $('meta[name="csrf-token"]').attr('content');
|
||||||
|
const api_key = $('meta[name="api-key"]').attr('content');
|
||||||
|
|
||||||
$('#flight_fares a').editable({
|
$('#flight_fares a').editable({
|
||||||
type: 'text',
|
type: 'text',
|
||||||
mode: 'inline',
|
mode: 'inline',
|
||||||
@@ -11,8 +15,8 @@ function setEditable() {
|
|||||||
ajaxOptions: {
|
ajaxOptions: {
|
||||||
type: 'post',
|
type: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
'x-api-key': '{{ Auth::user()->api_key }}',
|
'x-api-key': api_key,
|
||||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
'X-CSRF-TOKEN': csrf_token
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
params: function (params) {
|
params: function (params) {
|
||||||
@@ -28,6 +32,9 @@ function setEditable() {
|
|||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
const csrf_token = $('meta[name="csrf-token"]').attr('content');
|
||||||
|
const api_key = $('meta[name="api-key"]').attr('content');
|
||||||
|
|
||||||
setEditable();
|
setEditable();
|
||||||
|
|
||||||
$('#flight_fields_wrapper a.inline').editable({
|
$('#flight_fields_wrapper a.inline').editable({
|
||||||
@@ -38,8 +45,8 @@ $(document).ready(function () {
|
|||||||
ajaxOptions: {
|
ajaxOptions: {
|
||||||
type: 'post',
|
type: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
'x-api-key': '{{ Auth::user()->api_key }}',
|
'x-api-key': api_key,
|
||||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
'X-CSRF-TOKEN': csrf_token
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
params: function (params) {
|
params: function (params) {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
function setEditable() {
|
function setEditable() {
|
||||||
|
|
||||||
const token = $('meta[name="csrf-token"]').attr('content');
|
const token = $('meta[name="csrf-token"]').attr('content');
|
||||||
|
const api_key = $('meta[name="api-key"]').attr('content');
|
||||||
|
|
||||||
$('#aircraft_fares a').editable({
|
$('#aircraft_fares a').editable({
|
||||||
type: 'text',
|
type: 'text',
|
||||||
@@ -13,7 +14,7 @@ function setEditable() {
|
|||||||
ajaxOptions: {
|
ajaxOptions: {
|
||||||
type: 'post',
|
type: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
'x-api-key': '{{ Auth::user()->api_key }}',
|
'x-api-key': api_key,
|
||||||
'X-CSRF-TOKEN': token,
|
'X-CSRF-TOKEN': token,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -36,7 +37,7 @@ function setEditable() {
|
|||||||
ajaxOptions: {
|
ajaxOptions: {
|
||||||
type: 'post',
|
type: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
'x-api-key': '{{ Auth::user()->api_key }}',
|
'x-api-key': api_key,
|
||||||
'X-CSRF-TOKEN': token,
|
'X-CSRF-TOKEN': token,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -57,7 +58,7 @@ function setEditable() {
|
|||||||
ajaxOptions: {
|
ajaxOptions: {
|
||||||
type: 'post',
|
type: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
'x-api-key': '{{ Auth::user()->api_key }}',
|
'x-api-key': api_key,
|
||||||
'X-CSRF-TOKEN': token,
|
'X-CSRF-TOKEN': token,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -80,7 +81,7 @@ function setEditable() {
|
|||||||
ajaxOptions: {
|
ajaxOptions: {
|
||||||
type: 'post',
|
type: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
'x-api-key': '{{ Auth::user()->api_key }}',
|
'x-api-key': api_key,
|
||||||
'X-CSRF-TOKEN': token,
|
'X-CSRF-TOKEN': token,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user