send message box
This commit is contained in:
@@ -87,6 +87,26 @@ export function HotelProvider({ accessToken, children }) {
|
||||
//return res.json
|
||||
}
|
||||
|
||||
async function sendMessage({ conv_id, message }) {
|
||||
if (!conv_id) return;
|
||||
console.log("conv_id null at sendMessage")
|
||||
const payload = {
|
||||
conv_id,
|
||||
message
|
||||
};
|
||||
|
||||
console.log(JSON.stringify(payload));
|
||||
|
||||
const res = await fetch(`${API_BASE}/chat/send_message`, {
|
||||
method: "POST" ,
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessTokenSingle}`,
|
||||
"Content-Type" : "application/json",
|
||||
},
|
||||
body: JSON.stringify(payload),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// --- INITIAL DATA LOADING ---
|
||||
useEffect(() => {
|
||||
@@ -115,6 +135,7 @@ export function HotelProvider({ accessToken, children }) {
|
||||
users,
|
||||
updateRoomStatus,
|
||||
fetchMessages,
|
||||
sendMessage,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
||||
Reference in New Issue
Block a user