user eklleme
This commit is contained in:
@@ -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<UserFormValues>({
|
||||
@@ -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 {
|
||||
|
||||
@@ -28,11 +28,9 @@ export function UsersTable({ users }: UsersTableProps) {
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center justify-between space-y-2">
|
||||
<h3 className="text-lg font-medium">Kullanıcı Listesi</h3>
|
||||
{/*
|
||||
<Link href="/dashboard/users/new">
|
||||
<Link href="/dashboard/users/new?returnTo=/dashboard/settings">
|
||||
<Button size="sm">Yeni Kullanıcı</Button>
|
||||
</Link>
|
||||
*/}
|
||||
</div>
|
||||
<div className="rounded-md border">
|
||||
<Table>
|
||||
|
||||
Reference in New Issue
Block a user