mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-18 17:38:19 +08:00
core: 2fa support
This commit is contained in:
1 parent
f18547ba16
commit
fe1112e652
11 files changed
+200
-6
No files matched your search
@@ -31,10 +31,14 @@ interface Context extends ApiHandler {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export function registerResolver(typeName: string, key: string, value: string, func: (args: any, ctx: Context) => any, description?: string) {
|
||||
export function registerResolver(
|
||||
typeName: string, key: string, value: string,
|
||||
func: (args: any, ctx: Context, info: any) => any,
|
||||
description?: string,
|
||||
) {
|
||||
registerValue(typeName, key, value, description);
|
||||
const wrappedFunc = async (arg, ctx) => {
|
||||
const res = await func(arg, ctx);
|
||||
const wrappedFunc = async (arg, ctx, info) => {
|
||||
const res = await func(arg, ctx, info);
|
||||
if (typeof res !== 'object') return res;
|
||||
if (handlers[value]) Object.assign(res, handlers[value]);
|
||||
return res;
|
||||
|
||||
Reference in new issue
Block a user