feat: product detail page with chart, alert list, alert form
This commit is contained in:
19
src/components/ProductActions.tsx
Normal file
19
src/components/ProductActions.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
'use client'
|
||||
|
||||
export function ProductActions({ productId }: { productId: string }) {
|
||||
async function refresh() {
|
||||
const res = await fetch(`/api/products/${productId}/scrape`, { method: 'POST' })
|
||||
if (res.ok) location.reload()
|
||||
}
|
||||
async function del() {
|
||||
if (!confirm('Wirklich löschen?')) return
|
||||
const res = await fetch(`/api/products/${productId}`, { method: 'DELETE' })
|
||||
if (res.ok) location.href = '/'
|
||||
}
|
||||
return (
|
||||
<div className="flex gap-2">
|
||||
<button onClick={refresh} className="rounded bg-zinc-800 px-3 py-1.5 text-sm hover:bg-zinc-700">Jetzt aktualisieren</button>
|
||||
<button onClick={del} className="rounded bg-red-900 px-3 py-1.5 text-sm hover:bg-red-800">Löschen</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user