Skip to content

Commit

Permalink
rooms: add rooms api
Browse files Browse the repository at this point in the history
  • Loading branch information
hotlong committed Dec 25, 2024
1 parent e173e85 commit b36f547
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/@steedos-widgets/liveblocks/src/components/Provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,24 @@ export const AmisRoomsProvider = (props: any) => {

return result;
}}
// Get rooms' info from their ID
resolveRoomsInfo={async ({ roomIds }) => {
const searchParams = new URLSearchParams(
roomIds.map((roomId) => ["roomIds", roomId])
);
const response = await fetch(`${fixedBaseUrl}/v2/c/rooms?${searchParams}`, {
headers: {
"Authorization": `Bearer ${token}`
}
});

if (!response.ok) {
throw new Error("Problem resolving rooms info");
}

const roomsInfo = await response.json();
return roomsInfo;
}}
// Get users' info from their ID
resolveUsers={async ({ userIds }) => {
const searchParams = new URLSearchParams(
Expand Down

0 comments on commit b36f547

Please sign in to comment.