Skip to content

Commit

Permalink
Fix non-null assertions and improve error handling in appRoutes
Browse files Browse the repository at this point in the history
  • Loading branch information
mdarif committed Jan 25, 2025
1 parent aea5973 commit 16460a8
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions apps/employee/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,22 @@ export const appRoutes: Route[] = [
{
path: 'todo',
loadChildren: () =>
loadRemote<typeof import('todo/Routes')>('todo/Routes').then(
(m) => m!.remoteRoutes
),
loadRemote<typeof import('todo/Routes')>('todo/Routes')
.then((m) => m?.remoteRoutes ?? []) // Return empty array if remoteRoutes is undefined
.catch((err) => {
console.error('Failed to load todo routes:', err);
return []; // Return empty array in case of failure
}),
},
{
path: 'login',
loadChildren: () =>
loadRemote<typeof import('login/Routes')>('login/Routes').then(
(m) => m!.remoteRoutes
),
loadRemote<typeof import('login/Routes')>('login/Routes')
.then((m) => m?.remoteRoutes ?? []) // Return empty array if remoteRoutes is undefined
.catch((err) => {
console.error('Failed to load login routes:', err);
return []; // Return empty array in case of failure
}),
},
{
path: '',
Expand Down

0 comments on commit 16460a8

Please sign in to comment.