resolve conflicts btw ts interface
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;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export const userCreatedListener = (echo, userData, setNotifications, setunreadNotification) => {
|
||||
export const userCreatedListener = (echo, userData, setNotifications, setunreadNotification, updatePendingMembers) => {
|
||||
if (userData.isAdmin) {
|
||||
const channelName = "users.registration";
|
||||
echo.private(channelName)
|
||||
@@ -11,6 +11,7 @@ export const userCreatedListener = (echo, userData, setNotifications, setunreadN
|
||||
};
|
||||
setNotifications(prev => [newNotification, ...prev]);
|
||||
setunreadNotification(true);
|
||||
updatePendingMembers();
|
||||
});
|
||||
return channelName;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user