Skip to content

Commit 383c5f4

Browse files
committed
chore: update createApp templates
1 parent a66db2a commit 383c5f4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

adminforth/commands/createApp/templates/adminuser.ts.hbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import AdminForth, { AdminForthDataTypes } from 'adminforth';
22
import type { AdminForthResourceInput, AdminForthResource, AdminUser } from 'adminforth';
33
import { randomUUID } from 'crypto';
4+
import { logger } from 'adminforth';
45

56
async function allowedForSuperAdmin({ adminUser }: { adminUser: AdminUser }): Promise<boolean> {
67
return adminUser.dbUser.role === 'superadmin';
@@ -94,7 +95,7 @@ export default {
9495
},
9596
edit: {
9697
beforeSave: async ({ oldRecord, updates, adminUser, resource }: { oldRecord: any, updates: any, adminUser: AdminUser, resource: AdminForthResource }) => {
97-
console.log('Updating user', updates);
98+
logger.info(`Updating user, ${updates}`);
9899
if (oldRecord.id === adminUser.dbUser.id && updates.role) {
99100
return { ok: false, error: 'You cannot change your own role' };
100101
}

adminforth/commands/createApp/templates/index.ts.hbs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { fileURLToPath } from 'url';
55
import path from 'path';
66
import { Filters } from 'adminforth';
77
import { initApi } from './api.js';
8+
import { logger } from 'adminforth';
89

910
const ADMIN_BASE_URL = '';
1011

@@ -75,7 +76,7 @@ if (fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) {
7576
const port = 3500;
7677

7778
admin.bundleNow({ hotReload: process.env.NODE_ENV === 'development' }).then(() => {
78-
console.log('Bundling AdminForth SPA done.');
79+
logger.info('Bundling AdminForth SPA done.');
7980
});
8081

8182
admin.express.serve(app);
@@ -91,6 +92,6 @@ if (fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) {
9192
});
9293

9394
admin.express.listen(port, () => {
94-
console.log(`\n⚡ AdminForth is available at http://localhost:${port}${ADMIN_BASE_URL}\n`);
95+
logger.info(`\n⚡ AdminForth is available at http://localhost:${port}${ADMIN_BASE_URL}\n`);
9596
});
9697
}

0 commit comments

Comments
 (0)