feat: PUT /api/v3/chats/:roomId

This commit is contained in:
Julian Lam
2021-12-15 10:59:58 -05:00
parent eeffb9d978
commit 9a4fd5dc7e
7 changed files with 132 additions and 73 deletions

View File

@@ -13,10 +13,12 @@ define('forum/chats', [
'bootbox',
'alerts',
'chat',
'api',
], function (
components, translator, mousetrap,
recentChats, search, messages,
autocomplete, hooks, bootbox, alerts, chatModule
autocomplete, hooks, bootbox, alerts, chatModule,
api
) {
const Chats = {
initialised: false,
@@ -345,14 +347,9 @@ define('forum/chats', [
});
function submit() {
socket.emit('modules.chats.renameRoom', {
roomId: roomId,
newName: modal.find('#roomName').val(),
}, function (err) {
if (err) {
alerts.error(err);
}
});
api.put(`/chats/${roomId}`, {
name: modal.find('#roomName').val(),
}).catch(alerts.error);
}
};