Merge branch 'fix/reverbFromCrossOrigin' into 'dev'
fix reverb from cross origin See merge request sae-but2/2025-26/gestion-benevoles-association/Frontend!82
This commit is contained in:
@@ -14,8 +14,31 @@ export default function initEcho() {
|
||||
encrypted: import.meta.env.VITE_ENCRYPTED === 'true',
|
||||
cluster: import.meta.env.VITE_CLUSTER,
|
||||
enabledTransports: ['ws', 'wss'],
|
||||
authorizer: (channel) => {
|
||||
return {
|
||||
authorize: (socketId, callback) => {
|
||||
fetch(`${import.meta.env.VITE_API_URL}/broadcasting/auth`, {
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
socket_id: socketId,
|
||||
channel_name: channel.name,
|
||||
}),
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(data => callback(null, data))
|
||||
.catch(err => callback(err, null));
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
|
||||
window.Echo = echoInstance;
|
||||
return echoInstance;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user