Small fixes
This commit is contained in:
@@ -9,7 +9,7 @@ export default function NotFound() {
|
||||
Link Not Found
|
||||
</h2>
|
||||
<p className="mt-2 text-gray-600 dark:text-gray-400">
|
||||
The link you're looking for doesn't exist or has expired.
|
||||
The link you're looking for doesn't exist or has expired.
|
||||
</p>
|
||||
<Link
|
||||
href="/"
|
||||
|
||||
@@ -238,15 +238,15 @@ export function UrlsDataTable({ data }: UrlsDataTableProps) {
|
||||
const [columnVisibility, setColumnVisibility] = React.useState<VisibilityState>({})
|
||||
const router = useRouter()
|
||||
|
||||
function handleCopy(string: string) {
|
||||
const handleCopy = React.useCallback((string: string) => {
|
||||
navigator.clipboard.writeText(string).then(() => {
|
||||
toast.success("URL copied to clipboard")
|
||||
}).catch(() => {
|
||||
toast.error("Failed to copy URL")
|
||||
})
|
||||
}
|
||||
}, [])
|
||||
|
||||
async function handleDelete(id: string) {
|
||||
const handleDelete = React.useCallback(async (id: string) => {
|
||||
const res = await deleteUrl(id)
|
||||
|
||||
if (res.error) {
|
||||
@@ -255,8 +255,9 @@ export function UrlsDataTable({ data }: UrlsDataTableProps) {
|
||||
toast.success("URL deleted successfully")
|
||||
router.refresh()
|
||||
}
|
||||
}
|
||||
}, [router])
|
||||
|
||||
const tableColumns = React.useMemo(() => {
|
||||
const actionRow: ColumnDef<UrlRecord> = {
|
||||
id: "actions",
|
||||
enableHiding: false,
|
||||
@@ -297,7 +298,8 @@ export function UrlsDataTable({ data }: UrlsDataTableProps) {
|
||||
}
|
||||
}
|
||||
|
||||
const tableColumns = React.useMemo(() => [...columns, actionRow], [actionRow])
|
||||
return [...columns, actionRow]
|
||||
}, [handleCopy, handleDelete])
|
||||
|
||||
const table = useReactTable({
|
||||
data,
|
||||
|
||||
Reference in New Issue
Block a user