diff --git a/components/dashboard/user-form.tsx b/components/dashboard/user-form.tsx index 21db539..8dc1006 100644 --- a/components/dashboard/user-form.tsx +++ b/components/dashboard/user-form.tsx @@ -1,7 +1,7 @@ "use client" import { useState } from "react" -import { useRouter } from "next/navigation" +import { useRouter, useSearchParams } from "next/navigation" import { useForm } from "react-hook-form" import { zodResolver } from "@hookform/resolvers/zod" import * as z from "zod" @@ -77,6 +77,8 @@ interface UserFormProps { export function UserForm({ initialData, mode = "admin" }: UserFormProps) { const router = useRouter() + const searchParams = useSearchParams() + const returnTo = searchParams.get("returnTo") const [loading, setLoading] = useState(false) const form = useForm({ @@ -140,7 +142,10 @@ export function UserForm({ initialData, mode = "admin" }: UserFormProps) { ) router.refresh() - if (mode === "admin") { + router.refresh() + if (returnTo) { + router.push(returnTo) + } else if (mode === "admin") { router.push("/dashboard/users") } } catch { diff --git a/components/dashboard/users-table.tsx b/components/dashboard/users-table.tsx index 17fb6b8..57d55a3 100644 --- a/components/dashboard/users-table.tsx +++ b/components/dashboard/users-table.tsx @@ -28,11 +28,9 @@ export function UsersTable({ users }: UsersTableProps) {

Kullanıcı Listesi

- {/* - + - */}