diff --git a/src/pages/console/matrix/index.tsx b/src/pages/console/matrix/index.tsx index 916162d..9d8dbad 100644 --- a/src/pages/console/matrix/index.tsx +++ b/src/pages/console/matrix/index.tsx @@ -29,6 +29,14 @@ export default function MatrixMarketplace() { fetchProducts() }, []) + async function deleteProduct(id: number) { + const yes = confirm(`Are you sure you want to delete this product #${id}?`) + if (!yes) return + + await sni.delete('/cgi/ma/products/' + id) + window.location.reload() + } + return ( @@ -53,6 +61,9 @@ export default function MatrixMarketplace() { + diff --git a/src/pages/console/matrix/products/[id]/index.tsx b/src/pages/console/matrix/products/[id]/index.tsx index 2f9a566..ec69c58 100644 --- a/src/pages/console/matrix/products/[id]/index.tsx +++ b/src/pages/console/matrix/products/[id]/index.tsx @@ -25,6 +25,14 @@ export const getServerSideProps: GetServerSideProps = (async (context) => { }) satisfies GetServerSideProps<{ product: MaProduct; releases: any[] }> export default function ProductDetails({ product, releases }: InferGetServerSidePropsType) { + async function deleteRelease(id: number) { + const yes = confirm(`Are you sure you want to delete this release #${id}?`) + if (!yes) return + + await sni.delete('/cgi/ma/products/' + product.id + '/releases/' + id) + window.location.reload() + } + return ( @@ -63,6 +71,9 @@ export default function ProductDetails({ product, releases }: InferGetServerSide +