Adding custom javascript

If you want to add custom javascript to the Fleio app you can access and edit the following files:

  • /var/webapps/fleio/frontend/staff/assets/js/custom.js - for staff panel

  • /var/webapps/fleio/frontend/enduser/assets/js/custom.js - for enduser panel

Example of custom.js file:

(function () {
// window.setHeaders = function (request, getCookie) {
//   return {
//     CustomHeader: getCookie('customCookieName'),
//   }
// }
})();

Notice the usage of IIFE

Customizing request headers

After reading the above documentation about the custom.js file, besides custom javascript code you may want to write, overriding or adding headers when making requests is also possible. Just like in the above template, you can return in window.setHeaders function a dictionary representing the custom headers to add or to override. You can make use of the request param to add conditions based on request method for example. You can make use of the getCookie param that references a method used for getting a cookie by name (exemplified in the commented code of the template). Returning null will not update the headers at all.