diff --git a/resources/scripts/routers/AdminIpamRouter.tsx b/resources/scripts/routers/AdminIpamRouter.tsx index 9378e3f7068..ca22c7a7310 100644 --- a/resources/scripts/routers/AdminIpamRouter.tsx +++ b/resources/scripts/routers/AdminIpamRouter.tsx @@ -31,10 +31,15 @@ export const routes: Route[] = [ }, { path: ':poolId', - loader: ({ params }) => - query(getPoolKey(parseInt(params.poolId!)), () => - getAddressPool(parseInt(params.poolId!)) - ), + loader: async ({ params }) => { + try { + const poolId = parseInt(params.poolId!); + const pool = await query(getPoolKey(poolId), () => getAddressPool(poolId)); + return pool; + } catch (error) { + return null; + } + }, element: lazyLoad(lazy(() => import('./AdminIpamRouter'))), handle: { crumb: data => ({ @@ -49,17 +54,21 @@ export const routes: Route[] = [ }, { path: 'addresses', - loader: ({ params }) => { - const id = parseInt(params.poolId!) - const page = params.page ? parseInt(params.page) : 1 - - return query(getAddressesKey(id, page, ''), () => - getAddresses(id, { - page, - query: '', - include: ['server'], - }) - ) + loader: async ({ params }) => { + try { + const id = parseInt(params.poolId!) + const page = params.page ? parseInt(params.page) : 1 + const addresses = await query(getAddressesKey(id, page, ''), () => + getAddresses(id, { + page, + query: '', + include: ['server'], + }) + ) + return addresses + } catch (error) { + return null + } }, element: lazyLoad( lazy( diff --git a/resources/scripts/routers/AdminNodeRouter.tsx b/resources/scripts/routers/AdminNodeRouter.tsx index bd99474054e..ebbe9fbe8ef 100644 --- a/resources/scripts/routers/AdminNodeRouter.tsx +++ b/resources/scripts/routers/AdminNodeRouter.tsx @@ -25,10 +25,15 @@ export const routes: Route[] = [ }, { path: ':nodeId', - loader: ({ params }) => - query(getPoolKey(parseInt(params.nodeId!)), () => - getNode(parseInt(params.nodeId!)) - ), + loader: async ({ params }) => { + try { + const nodeId = parseInt(params.nodeId!); + const node = await query(getPoolKey(nodeId), () => getNode(nodeId)); + return node; + } catch (error) { + return null; + } + }, element: lazyLoad( lazy(() => import('@/routers/AdminNodeRouter')) ), diff --git a/resources/scripts/routers/AdminUserRouter.tsx b/resources/scripts/routers/AdminUserRouter.tsx index b64b2d609ce..702356fd951 100644 --- a/resources/scripts/routers/AdminUserRouter.tsx +++ b/resources/scripts/routers/AdminUserRouter.tsx @@ -24,10 +24,15 @@ export const routes: Route[] = [ { path: ':id', element: lazyLoad(lazy(() => import('./AdminUserRouter'))), - loader: ({ params }) => - query(getKey(parseInt(params.id!)), () => - getUser(parseInt(params.id!)) - ), + loader: async ({ params }) => { + try { + const id = parseInt(params.id!); + const user = await query(getKey(id), () => getUser(id)); + return user; + } catch (error) { + return null; + } + }, children: [ { path: 'settings',