fix(web-app): update dashboard navigation to use the router directly and refresh admin tabs on login changes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import * as appstate from '../appstate.js';
|
||||
import * as shared from './shared/index.js';
|
||||
import { appRouter } from '../router.js';
|
||||
import {
|
||||
css,
|
||||
cssManager,
|
||||
@@ -77,24 +78,15 @@ export class SgViewDashboard extends DeesElement {
|
||||
private handleNavigate(e: CustomEvent) {
|
||||
const { type, id } = e.detail;
|
||||
if (type === 'org' && id) {
|
||||
const { appRouter } = await_import_router();
|
||||
appRouter.navigateToEntity('organizations', id);
|
||||
} else if (type === 'package' && id) {
|
||||
const { appRouter } = await_import_router();
|
||||
appRouter.navigateToEntity('packages', id);
|
||||
} else if (type === 'packages') {
|
||||
const { appRouter } = await_import_router();
|
||||
appRouter.navigateToView('packages');
|
||||
} else if (type === 'tokens') {
|
||||
const { appRouter } = await_import_router();
|
||||
appRouter.navigateToView('tokens');
|
||||
} else if (type === 'organizations') {
|
||||
appRouter.navigateToView('organizations');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Lazy import to avoid circular dependency
|
||||
function await_import_router() {
|
||||
// Dynamic import not needed here since router is a separate module
|
||||
// We use a workaround by importing at the module level
|
||||
return { appRouter: (globalThis as any).__sgAppRouter };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user