Skip to content

Commit

Permalink
[update] /room/[room-id] page
Browse files Browse the repository at this point in the history
  • Loading branch information
MridulDhiman committed Jan 5, 2025
1 parent 373e96c commit 4db0ed5
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/app/room/[roomId]/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ export default async function CollaborativeRoomPage({ params, searchParams }) {

if (roomId !== "new-room") {
const url = `${process.env.NEXT_PUBLIC_BACKEND_URL}/api/v1/room/${roomId}`;
const response = fetch(url, {
const response = await fetch(url, {
method: "GET",
headers: {
"Authorization" : `Bearer ${session?.user?.name}`
Authorization: `Bearer ${session?.user?.name}`,
}
});
const responseBody = await response.json();
Expand All @@ -56,15 +57,13 @@ export default async function CollaborativeRoomPage({ params, searchParams }) {
redirect("/your-work");
}


console.log("data: ", data);


shardDetails = data.shard;
}

console.log("Shard details: ", shardDetails);

const { creator, isTemplate, _id } = shardDetails;
const { creator, isTemplate, id } = shardDetails;

if (session) {
if (roomId === "new-room" && session?.user?.name !== creator) {
Expand All @@ -78,7 +77,7 @@ export default async function CollaborativeRoomPage({ params, searchParams }) {
<CollaborativeSandpackEditor
shardDetails={JSON.stringify(shardDetails)}
template={isTemplate ? shardDetails.templateType : "react"}
id={_id.toString() ?? ""}
id={id.toString() ?? ""}
isNewShard={roomId === "new-room"}
creator={creator}
/>
Expand Down

0 comments on commit 4db0ed5

Please sign in to comment.