Add a hack to append the X-Cachet-Token when in the dashboard

This commit is contained in:
Nico Stapelbroek
2018-01-27 23:54:40 +01:00
parent 82861a37ae
commit 6811612955
2 changed files with 6 additions and 0 deletions

View File

@@ -16,6 +16,9 @@ $(function () {
beforeSend: function (xhr) {
xhr.setRequestHeader('Accept', 'application/json');
// xhr.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
if (typeof window.apiKey !== 'undefined') {
xhr.setRequestHeader('X-Cachet-Token', window.apiKey);
}
},
statusCode: {
401: function () {

View File

@@ -62,4 +62,7 @@
</body>
@yield('js')
<script src="{{ mix('dist/js/all.js') }}"></script>
<script type="text/javascript">
window.apiKey = "{{ auth()->user()->api_key }}";
</script>
</html>