Reimplemented rooms with live update
This commit is contained in:
1 parent
347f4b0999
commit
94c544b161
7 files changed
+25
-23
No files matched your search
@@ -25,7 +25,7 @@ export async function createRoomAction(
|
||||
|
||||
const result = await createRoom(name.trim());
|
||||
if (result.error) {
|
||||
return { error: result.error };
|
||||
return { error: "Couldn't create the room." };
|
||||
}
|
||||
|
||||
revalidatePath("/rooms");
|
||||
@@ -54,7 +54,9 @@ export async function addMemberAction(
|
||||
|
||||
const result = await addMember(roomId, trimmed);
|
||||
if (result.error) {
|
||||
return { error: result.error };
|
||||
return {
|
||||
error: "Couldn't add the user to the room or they are already a member.",
|
||||
};
|
||||
}
|
||||
|
||||
revalidatePath("/rooms");
|
||||
@@ -64,7 +66,7 @@ export async function addMemberAction(
|
||||
export async function deleteRoomAction(roomId: string) {
|
||||
const result = await deleteRoom(roomId);
|
||||
if (result.error) {
|
||||
return { error: result.error };
|
||||
return { error: "Couldn't delete the room." };
|
||||
}
|
||||
|
||||
revalidatePath("/rooms");
|
||||
@@ -74,7 +76,7 @@ export async function deleteRoomAction(roomId: string) {
|
||||
export async function removeMemberAction(roomId: string, userId: string) {
|
||||
const result = await removeMember(roomId, userId);
|
||||
if (result.error) {
|
||||
return { error: result.error };
|
||||
return { error: "Couldn't remove the member with the id " + userId };
|
||||
}
|
||||
|
||||
revalidatePath(`/rooms/${roomId}`);
|
||||
|
||||
Reference in new issue
Block a user