mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
refactor(store middleware): get adminStore through function
This commit is contained in:
parent
ba6d33c115
commit
e8e45360d3
1 changed files with 2 additions and 4 deletions
|
|
@ -1,13 +1,11 @@
|
||||||
import { AppMiddleware } from '@/app.ts';
|
import { AppMiddleware } from '@/app.ts';
|
||||||
import { Conf } from '@/config.ts';
|
|
||||||
import { UserStore } from '@/storages/UserStore.ts';
|
import { UserStore } from '@/storages/UserStore.ts';
|
||||||
import { eventsDB } from '@/storages.ts';
|
import { getAdminStore } from '@/storages/adminStore.ts';
|
||||||
|
|
||||||
/** Store middleware. */
|
/** Store middleware. */
|
||||||
const storeMiddleware: AppMiddleware = async (c, next) => {
|
const storeMiddleware: AppMiddleware = async (c, next) => {
|
||||||
const pubkey = c.get('pubkey');
|
const pubkey = c.get('pubkey');
|
||||||
const adminStore = new UserStore(Conf.pubkey, eventsDB);
|
const adminStore = getAdminStore();
|
||||||
|
|
||||||
if (pubkey) {
|
if (pubkey) {
|
||||||
const store = new UserStore(pubkey, adminStore);
|
const store = new UserStore(pubkey, adminStore);
|
||||||
c.set('store', store);
|
c.set('store', store);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue