"use client" import React, { useState } from 'react' import { Box, Container, Paper, Table, Button, TextInput, useMantineTheme, Flex, Image } from '@mantine/core' import Example from './query' interface InventoryItem { id: number name: string price: number quantity: number } async function fetchBlob(url: string) { const response = await fetch(url) // Here is the significant part // reading the stream as a blob instead of json return response.blob() } export default function InventoryPage() { const theme = useMantineTheme() const [items, setItems] = useState([]) const [name, setName] = useState('') const [price, setPrice] = useState('') const [quantity, setQuantity] = useState('') const addItem = () => { setItems([ ...items, { id: items.length + 1, name, price: parseFloat(price), quantity: parseInt(quantity), }, ]) setName('') setPrice('') setQuantity('') } const [imageSourceUrl, setImageSourceUrl] = React.useState("") const downloadImageAndSetSource = async (imageUrl: any) => { const image = await fetchBlob(imageUrl) setImageSourceUrl(URL.createObjectURL(image)) } return ( {items.map((item) => ( ))}
ID Name Price Quantity
{item.id} {item.name} {item.price} {item.quantity}
setName(event.currentTarget.value)} /> setPrice(event.currentTarget.value)} /> setQuantity(event.currentTarget.value)} />
{/* would fetch the source from axios */} ITEM
) }