From 2fba7c82d7bba816bcf0d62951b04f4e875b5996 Mon Sep 17 00:00:00 2001 From: joshuasilva414 Date: Thu, 2 Jan 2025 21:19:53 -0600 Subject: [PATCH] fix setItem action --- apps/web/src/actions/admin/modify-nav-item.ts | 4 ++-- .../admin/toggles/NavItemsManager.tsx | 17 ++++++++++------- apps/web/src/lib/utils/server/redis.ts | 3 ++- package.json | 2 +- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/apps/web/src/actions/admin/modify-nav-item.ts b/apps/web/src/actions/admin/modify-nav-item.ts index 99185e69..021268c0 100644 --- a/apps/web/src/actions/admin/modify-nav-item.ts +++ b/apps/web/src/actions/admin/modify-nav-item.ts @@ -21,7 +21,7 @@ export const setItem = adminAction encodeURIComponent(name), ); await hset( - "config:navitems:${encodeURIComponent(name)}", + `config:navitems:${encodeURIComponent(name)}`, { url, name, @@ -49,7 +49,7 @@ export const toggleItem = adminAction ctx: { user, userId }, }) => { await hset( - "config:navitems:${encodeURIComponent(name)}", + `config:navitems:${encodeURIComponent(name)}`, { enabled: statusToSet, }, diff --git a/apps/web/src/components/admin/toggles/NavItemsManager.tsx b/apps/web/src/components/admin/toggles/NavItemsManager.tsx index a24784c3..b81369af 100644 --- a/apps/web/src/components/admin/toggles/NavItemsManager.tsx +++ b/apps/web/src/components/admin/toggles/NavItemsManager.tsx @@ -60,13 +60,16 @@ export function NavItemsManager({ navItems }: NavItemsManagerProps) { {navItems.map((item) => ( - + - {item.name} + {item?.name ?? ""} - - {item.url} + + {item?.url ?? ""} @@ -75,8 +78,8 @@ export function NavItemsManager({ navItems }: NavItemsManagerProps) { onCheckedChange={(checked) => didToggle(item.name, checked)} /> */} @@ -85,7 +88,7 @@ export function NavItemsManager({ navItems }: NavItemsManagerProps) {