Skip to content

Commit 3d5588a

Browse files
committed
fix: handle redirection error on create-todo action
1 parent 1b2019b commit 3d5588a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/modules/todos/actions/create-todo.action.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ export async function createTodoAction(formData: FormData) {
8282
revalidatePath(todosRoutes.list);
8383
redirect(todosRoutes.list);
8484
} catch (error) {
85+
// Handle Next.js redirect errors - these are not actual errors
86+
if (error instanceof Error && error.message === "NEXT_REDIRECT") {
87+
throw error; // Re-throw redirect errors as-is
88+
}
89+
8590
console.error("Error creating todo:", error);
8691

8792
if (

0 commit comments

Comments
 (0)