metamigo-api: work on making it build
This commit is contained in:
parent
38e68852d9
commit
ef216f7b1c
35 changed files with 407 additions and 322 deletions
|
|
@ -1,26 +0,0 @@
|
|||
import type * as Hapi from "@hapi/hapi";
|
||||
import NextAuthPlugin, { AdapterFactory } from "@digiresilience/hapi-nextauth";
|
||||
import { NextAuthAdapter } from "@digiresilience/metamigo-common";
|
||||
import type { SavedUser, UnsavedUser, SavedSession } from "@digiresilience/metamigo-common";
|
||||
import { IAppConfig } from "config";
|
||||
|
||||
export const registerNextAuth = async (
|
||||
server: Hapi.Server,
|
||||
config: IAppConfig
|
||||
): Promise<void> => {
|
||||
// I'm not sure why I need to be so explicit with the generic types here
|
||||
// I thought ts could figure out the generics based on the concrete params, but apparently not
|
||||
const nextAuthAdapterFactory: AdapterFactory<
|
||||
SavedUser,
|
||||
UnsavedUser,
|
||||
SavedSession
|
||||
> = (request: Hapi.Request) => new NextAuthAdapter(request.db());
|
||||
|
||||
await server.register({
|
||||
plugin: NextAuthPlugin,
|
||||
options: {
|
||||
nextAuthAdapterFactory,
|
||||
sharedSecret: config.nextAuth.secret,
|
||||
},
|
||||
});
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue