chat support
This commit is contained in:
@@ -1 +1,6 @@
|
||||
import './bootstrap';
|
||||
import "./bootstrap";
|
||||
|
||||
// VERY IMPORTANT — Load Echo globally
|
||||
import "./echo";
|
||||
|
||||
console.log("[APP] app.js loaded");
|
||||
|
||||
7
resources/js/bootstrap.js
vendored
7
resources/js/bootstrap.js
vendored
@@ -1,4 +1,9 @@
|
||||
import axios from 'axios';
|
||||
window.axios = axios;
|
||||
|
||||
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
||||
axios.defaults.withCredentials = true;
|
||||
axios.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest";
|
||||
axios.defaults.headers.common["X-CSRF-TOKEN"] = document.querySelector(
|
||||
'meta[name="csrf-token"]'
|
||||
).content;
|
||||
|
||||
|
||||
30
resources/js/echo.js
Normal file
30
resources/js/echo.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import Echo from "laravel-echo";
|
||||
import Pusher from "pusher-js";
|
||||
|
||||
window.Pusher = Pusher;
|
||||
|
||||
console.log("[ECHO] Initializing Reverb...");
|
||||
|
||||
window.Echo = new Echo({
|
||||
broadcaster: "reverb",
|
||||
key: import.meta.env.VITE_REVERB_APP_KEY,
|
||||
|
||||
wsHost: import.meta.env.VITE_REVERB_HOST,
|
||||
wsPort: Number(import.meta.env.VITE_REVERB_PORT),
|
||||
|
||||
forceTLS: false,
|
||||
disableStats: true,
|
||||
|
||||
authEndpoint: "/broadcasting/auth",
|
||||
|
||||
auth: {
|
||||
headers: {
|
||||
"X-CSRF-TOKEN": document
|
||||
.querySelector('meta[name="csrf-token"]')
|
||||
?.getAttribute("content"),
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
console.log("[ECHO] Loaded Successfully!", window.Echo);
|
||||
Reference in New Issue
Block a user