rework sidemenu + fix no categories / links

This commit is contained in:
Sonny
2022-04-28 18:22:39 +02:00
parent 1ab51979fe
commit 1a5fb2eee4
14 changed files with 309 additions and 853 deletions

28
utils/front.ts Normal file
View File

@@ -0,0 +1,28 @@
import { Category, Link } from "../types"
export function BuildCategory({ id, name, order, links = [], createdAt, updatedAt }): Category {
return {
id,
name,
links: links.map((link) => BuildLink(link, { categoryId: id, categoryName: name })),
order,
createdAt,
updatedAt
}
}
export function BuildLink({ id, name, url, order, favorite, createdAt, updatedAt }, { categoryId, categoryName }): Link {
return {
id,
name,
url,
category: {
id: categoryId,
name: categoryName
},
order,
favorite,
createdAt,
updatedAt
}
}