35 lines
1,010 B
TypeScript
35 lines
1,010 B
TypeScript
import axios from "axios";
|
|
import GLightbox from "glightbox";
|
|
import * as bootstrap from "bootstrap";
|
|
|
|
const metaCSRFToken = document.querySelector("meta[name='csrf-token']");
|
|
|
|
if (!metaCSRFToken) {
|
|
throw new Error("Missing meta CSRF token");
|
|
}
|
|
|
|
/**
|
|
* We'll load the axios HTTP library which allows us to easily issue requests
|
|
* to our Laravel back-end. This library automatically handles sending the
|
|
* CSRF token as a header based on the value of the "XSRF" token cookie.
|
|
*/
|
|
axios.defaults.headers.common = {
|
|
Accept: "application/json, text/plain, */*",
|
|
"X-Requested-With": "XMLHttpRequest",
|
|
"X-CSRF-TOKEN": metaCSRFToken.getAttribute("content"),
|
|
};
|
|
|
|
window.axios = axios;
|
|
window.bootstrap = bootstrap;
|
|
|
|
// enable bs tooltips
|
|
const tooltipTriggerList = [].slice.call(
|
|
document.querySelectorAll("[data-bs-toggle='tooltip']")
|
|
);
|
|
tooltipTriggerList.map(function (tooltipTriggerEl) {
|
|
return new bootstrap.Tooltip(tooltipTriggerEl);
|
|
});
|
|
|
|
new GLightbox({
|
|
selector: ".glightbox",
|
|
});
|