Fix race condition in chat

This commit is contained in:
cuom1999 2024-08-13 17:57:05 +07:00
parent 7406d081aa
commit 8cd7327d20

View file

@ -141,8 +141,11 @@
message: message, message: message,
}, },
success: function (data) { success: function (data) {
// make sure user is still in the same room
if (room == window.room_id) {
add_message(data); add_message(data);
callback(true); callback(true);
}
}, },
error: function (data) { error: function (data) {
console.log('Could not add new message'); console.log('Could not add new message');