Skip to content

Commit 2617c7a

Browse files
committed
dev-demo improvements
1 parent 1e41e53 commit 2617c7a

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

dev-demo/custom/Dash.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ onMounted(async () => {
308308
// Fetch data from the API
309309
// and set it to the chartData
310310
try {
311-
null.a
312311
data.value = await callApi({path: '/api/dashboard/', method: 'GET'});
313312
} catch (error) {
314313
adminforth.alert({

dev-demo/index.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,6 @@ async function seedDatabase() {
4141
};
4242

4343

44-
const demoChecker = async ({ record, adminUser, resource }) => {
45-
if (adminUser.dbUser.role !== 'superadmin') {
46-
return { ok: false, error: "You can't do this on demo.adminforth.dev" }
47-
}
48-
return { ok: true };
49-
}
50-
5144
export const admin = new AdminForth({
5245
baseUrl : ADMIN_BASE_URL,
5346
auth: {
@@ -93,7 +86,7 @@ export const admin = new AdminForth({
9386
customization: {
9487
customComponentsDir: './custom',
9588
globalInjections: {
96-
// userMenu: '@@/login2.vue',
89+
userMenu: '@@/login2.vue',
9790
header: '@@/PropertyCost.vue',
9891
},
9992
customPages:[{
@@ -304,7 +297,7 @@ const port = process.env.PORT || 3000;
304297
app.get(
305298
'/api/testtest/',
306299
admin.express.authorize(
307-
async (req, res, next) => {
300+
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
308301
res.json({ ok: true, data: [1,2,3], adminUser: req.adminUser });
309302
}
310303
)
@@ -313,7 +306,7 @@ app.get(
313306
app.get(`${ADMIN_BASE_URL}/api/dashboard/`,
314307
admin.express.authorize(
315308
admin.express.translatable(
316-
async (req, res) => {
309+
async (req: express.Request, res: express.Response) => {
317310
admin.getPluginByClassName<AuditLogPlugin>('AuditLogPlugin').logCustomAction(
318311
'aparts',
319312
null,
@@ -335,7 +328,7 @@ app.get(`${ADMIN_BASE_URL}/api/dashboard/`,
335328
`
336329
).all(days);
337330

338-
const totalAparts = apartsByDays.reduce((acc, { count }) => acc + count, 0);
331+
const totalAparts = apartsByDays.reduce((acc: number, { count }: { count:number }) => acc + count, 0);
339332

340333
// add listed, unlisted, listedPrice, unlistedPrice
341334
const listedVsUnlistedByDays = await db.prepare(
@@ -364,8 +357,12 @@ app.get(`${ADMIN_BASE_URL}/api/dashboard/`,
364357
`
365358
).all(days);
366359

367-
const totalListedPrice = Math.round(listedVsUnlistedByDays.reduce((acc, { listedPrice }) => acc + listedPrice, 0));
368-
const totalUnlistedPrice = Math.round(listedVsUnlistedByDays.reduce((acc, { unlistedPrice }) => acc + unlistedPrice, 0));
360+
const totalListedPrice = Math.round(listedVsUnlistedByDays.reduce((
361+
acc: number, { listedPrice }: { listedPrice:number }
362+
) => acc + listedPrice, 0));
363+
const totalUnlistedPrice = Math.round(listedVsUnlistedByDays.reduce((
364+
acc: number, { unlistedPrice }: { unlistedPrice:number }
365+
) => acc + unlistedPrice, 0));
369366

370367
res.json({
371368
apartsByDays,

0 commit comments

Comments
 (0)