mirror of
https://github.com/vercel-labs/natural-language-postgres.git
synced 2026-11-04 08:10:38 +00:00
26 lines
583 B
TypeScript
26 lines
583 B
TypeScript
'use client'
|
|
|
|
import { useRouter } from 'next/navigation'
|
|
import { useTransition } from 'react'
|
|
|
|
export default function RefreshButton() {
|
|
const router = useRouter()
|
|
const [isPending, startTransition] = useTransition()
|
|
|
|
return (
|
|
<button
|
|
className={`${
|
|
isPending ? 'cursor-not-allowed text-gray-400' : ''
|
|
} text-sm text-gray-500 hover:text-gray-900`}
|
|
disabled={isPending}
|
|
onClick={() => {
|
|
startTransition(() => {
|
|
router.refresh()
|
|
})
|
|
}}
|
|
>
|
|
{isPending ? 'Refreshing...' : 'Refresh'}
|
|
</button>
|
|
)
|
|
}
|