Skip to content

Commit

Permalink
[frontend] Remove unnecessary code from redirect in server action
Browse files Browse the repository at this point in the history
  • Loading branch information
lim396 committed Feb 15, 2024
1 parent 371c388 commit 986a7e8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions frontend/app/lib/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { revalidatePath } from "next/cache";
import { cookies } from "next/headers";
import { redirect, RedirectType } from "next/navigation";
import { redirect } from "next/navigation";
import {
AccessLevel,
FriendRequestsEntity,
Expand Down Expand Up @@ -236,7 +236,7 @@ export async function createRoom(
console.error("createRoom error: ", data);
return { error: data.message };
} else {
redirect(`/room/${data.id}`, RedirectType.push);
redirect(`/room/${data.id}`);
}
}

Expand All @@ -261,7 +261,7 @@ export async function createDirectRoom(userId: number) {
console.error("createDirectRoom error: ", data);
return { error: data.message };
} else {
redirect(`/room/${data.id}`, RedirectType.push);
redirect(`/room/${data.id}`);
}
}

Expand All @@ -286,12 +286,12 @@ export async function joinRoom(
redirect("/login");
}
if (res.status === 409) {
redirect(`/room/${roomId}`, RedirectType.push);
redirect(`/room/${roomId}`);
} else if (!res.ok) {
console.error("joinRoom error: ", data);
return { error: data.message };
} else {
redirect(`/room/${roomId}`, RedirectType.push);
redirect(`/room/${roomId}`);
}
}

Expand Down

0 comments on commit 986a7e8

Please sign in to comment.