feat: split out dividers; proper block sorting

This commit is contained in:
Cory Dransfeldt 2024-07-14 21:17:17 -07:00
parent 4b908fc3df
commit 1a6e250875
No known key found for this signature in database
5 changed files with 13 additions and 8 deletions

View file

@ -38,7 +38,7 @@ const fetchTagsForPost = async (postId) => {
const fetchBlocksForPost = async (postId) => {
const { data, error } = await supabase
.from('posts_blocks')
.select('collection, item')
.select('collection, item, sort')
.eq('posts_id', postId)
if (error) {
@ -48,8 +48,10 @@ const fetchBlocksForPost = async (postId) => {
const blocks = await Promise.all(data.map(async block => {
const blockData = await fetchBlockData(block.collection, block.item)
return {
type: block.collection,
type: block['collection'],
sort: block['sort'],
...blockData
}
}))