mirror of
https://github.com/aljazceru/ditto.git
synced 2026-02-23 05:56:03 +01:00
Rename all middleware to thingMiddleware
This commit is contained in:
16
src/middleware/storeMiddleware.ts
Normal file
16
src/middleware/storeMiddleware.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { AppMiddleware } from '@/app.ts';
|
||||
import { UserStore } from '@/storages/UserStore.ts';
|
||||
import { Storages } from '@/storages.ts';
|
||||
|
||||
/** Store middleware. */
|
||||
export const storeMiddleware: AppMiddleware = async (c, next) => {
|
||||
const pubkey = await c.get('signer')?.getPublicKey();
|
||||
|
||||
if (pubkey) {
|
||||
const store = new UserStore(pubkey, Storages.admin);
|
||||
c.set('store', store);
|
||||
} else {
|
||||
c.set('store', Storages.admin);
|
||||
}
|
||||
await next();
|
||||
};
|
||||
Reference in New Issue
Block a user