From d22c606960a5e50f938075f7f3778dc9aa55cef5 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 30 Apr 2024 13:27:30 -0500 Subject: [PATCH] storeMiddleware: pass through admin UserStore --- src/middleware/store.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/middleware/store.ts b/src/middleware/store.ts index a22bb79..67bee0a 100644 --- a/src/middleware/store.ts +++ b/src/middleware/store.ts @@ -1,16 +1,18 @@ import { AppMiddleware } from '@/app.ts'; +import { Conf } from '@/config.ts'; import { UserStore } from '@/storages/UserStore.ts'; import { eventsDB } from '@/storages.ts'; /** Store middleware. */ const storeMiddleware: AppMiddleware = async (c, next) => { const pubkey = c.get('pubkey'); + const adminStore = new UserStore(Conf.pubkey, eventsDB); if (pubkey) { - const store = new UserStore(pubkey, eventsDB); + const store = new UserStore(pubkey, adminStore); c.set('store', store); } else { - c.set('store', eventsDB); + c.set('store', adminStore); } await next(); };