adminforth 1.2.90 → 1.2.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -160,7 +160,8 @@ export default class AdminForthRestAPI {
160
160
  function processMenuItem(menuItem) {
161
161
  return __awaiter(this, void 0, void 0, function* () {
162
162
  if (menuItem.badge) {
163
- if (typeof menuItem.badge === 'function') {
163
+ // if it is promise, wait for it
164
+ if (menuItem.badge && menuItem.badge.then || typeof menuItem.badge === 'function') {
164
165
  menuItem.badge = yield menuItem.badge(adminUser);
165
166
  }
166
167
  }
@@ -189,7 +189,8 @@ export default class AdminForthRestAPI {
189
189
 
190
190
  async function processMenuItem(menuItem) {
191
191
  if (menuItem.badge) {
192
- if (typeof menuItem.badge === 'function') {
192
+ // if it is promise, wait for it
193
+ if (menuItem.badge && menuItem.badge.then || typeof menuItem.badge === 'function') {
193
194
  menuItem.badge = await menuItem.badge(adminUser);
194
195
  }
195
196
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.2.90",
3
+ "version": "1.2.91",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -474,7 +474,7 @@ export type AdminForthConfigMenuItem = {
474
474
  * Optional callback which will be called before rendering the menu for each item.
475
475
  * Result of callback if not null will be used as a small badge near the menu item.
476
476
  */
477
- badge?: string | ((user: AdminUser) => string),
477
+ badge?: string | ((user: AdminUser) => Promise<string>),
478
478
  }
479
479
 
480
480