Skip to content

Latest commit

 

History

History
100 lines (63 loc) · 1.23 KB

code_samples.md

File metadata and controls

100 lines (63 loc) · 1.23 KB

    try {
        
    } catch (e) {        
        console.log('Error while retrieving items', e)
    }
let items: WidgetItem[] = []
import {fetchItems} from '../../../src/utils/fetch/items'
const response = await fetchItems(nextCookies, boardId)
        if (Array.isArray(response)) {
            items = response.map( (json: string) => JSON.parse(json) )
        }

!!items.length && items.map(item => )
<li key={item.id}>
<p>{item.id}</p>
<p>Type: {item.type}</p>
 <p>{item.data.content || item.data.title}</p>

    async function createItemOnBoard(data: FormData) {}
'use server'
let content: string = data.get('content') as string;
await createItem(cookies(), boardId, content)
revalidatePath(`/boards/${boardId}`)

    let [, startTransition] = useTransition()
import {deleteItemFromBoard} from "../../app/actions";
 <ItemView boardId={boardId} itemJson={JSON.stringify(item)}/>