Update codebase to work with docker setup. a key config is added in .env to make it optional

This commit is contained in:
Afiq Hamzah
2025-07-16 09:22:44 +08:00
parent 4d577233b3
commit 87eccb5234
2 changed files with 19 additions and 4 deletions
@@ -26,9 +26,9 @@ class PermohonanController extends Controller
{
$auth_user = Auth::user();
if(Hash::check($request->passsemula, Auth::user()->password))
return 1;
return response()->json(1);
else
return 0;
return response()->json(0);
}
public function CetakanPB(Request $request)
+17 -2
View File
@@ -9,7 +9,23 @@ window._ = require('lodash');
try {
window.Popper = require('popper.js').default;
window.$ = window.jQuery = require('jquery');
window.axios = require('axios');
if(process.env.MIX_USE_DOCKER == 'true'){
window.$.ajaxSetup({
beforeSend: function (xhr) {
xhr.setRequestHeader('X-Requested-With', 'admin arrahn');
xhr.setRequestHeader('accept', '*/*');
}
});
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
delete window.axios.defaults.headers.common['X-Requested-With'];
window.axios.defaults.headers.common['Accept'] = '*/*';
}
require('bootstrap');
} catch (e) {}
@@ -19,9 +35,7 @@ try {
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
window.axios = require('axios');
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
/**
* Echo exposes an expressive API for subscribing to channels and listening
@@ -33,6 +47,7 @@ import Echo from 'laravel-echo';
window.Pusher = require('pusher-js');
window.Echo = new Echo({
broadcaster: 'pusher',
key: process.env.MIX_PUSHER_APP_KEY,