add user to conv fix & conv create impl

This commit is contained in:
2026-01-01 15:29:38 +01:00
parent 39867c2c36
commit 69115486ed
2 changed files with 61 additions and 7 deletions

View File

@@ -63,6 +63,23 @@ export function HotelProvider({ accessToken, children, resClientId}) {
return users;
}
async function createConversation(name) {
const payload = {
name
};
const res = await fetch(`${API_BASE}/chat/create_conversation`, {
method: "POST",
headers: {
Authorization: `Bearer ${accessTokenSingle}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
}
async function fetchConversations() {
const res = await fetch(`${API_BASE}/chat/get_conv`, {
method: "POST",
@@ -101,7 +118,7 @@ export function HotelProvider({ accessToken, children, resClientId}) {
//return res.json
}
async function fetchConvUsers({ conv_id }) {
async function fetchConvUsers({ conv_id }) {
const payload = {
conv_id,
@@ -124,7 +141,6 @@ async function fetchConvUsers({ conv_id }) {
//return res.json
}
async function sendMessage({ conv_id, message }) {
if (!conv_id) {
console.log("conv_id null at sendMessage")
@@ -206,6 +222,7 @@ async function fetchConvUsers({ conv_id }) {
sendMessage,
fetchHotelUsers,
addUserToConv,
createConversation
}}
>
{children}