redirect issues

I have issues with redirect not working properly when called from a server actions , the account deletion work as intended but
redirect('/')
doesn't seems to work it just finish the task and remain on the same page what am I missing
am using app-router with drizzle-orm
"use server";
import { redirect } from "next/navigation";
export async function deleteProfile() {
  const session = await getServerAuthSession();
  if (!session) return { message: "Unauthorized" };
  try {
    await db
      .delete(users)
      .where(eq(users.id, session.user.id))
      .catch((e) => {
        console.log(e);
      });
    revalidatePath("/dashboard/settings/profile");
    redirect("/");
  } catch (error) {
    return { message: "Error deleting profile" };
  }
}
//client code
'use client'
<Button variant="destructive" onClick={() => deleteProfile()} type="submit">
      delete profile
    </Button>
Was this page helpful?