generated from t/malachite
add: chat pins
This commit is contained in:
parent
9546c580e7
commit
82eafdadb3
21 changed files with 330 additions and 56 deletions
|
@ -326,3 +326,27 @@ function create_direct_chat_with_user(id) {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
function pin_message(e, id) {
|
||||
fetch(`/api/v1/chats/${STATE.chat_id}/pins/${id}`, {
|
||||
method: "POST",
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
show_message(res.message, res.ok);
|
||||
|
||||
if (res.ok) {
|
||||
e.target.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function unpin_message(id) {
|
||||
fetch(`/api/v1/chats/${STATE.chat_id}/pins/${id}`, {
|
||||
method: "DELETE",
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
show_message(res.message, res.ok);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue