Custom plugin not found type from ReturnType<typeof superAdminTableDataPlugin>

Hi everyone, I dont know why the Return Type of superAdminTableDataPlugin cannot get the type. Please somebody help me clear this .
export const superAdminTableDataPlugin = () => {
return {
id: 'super-admin-table-data',
hooks: {
before: [
{
matcher: (ctx) => ctx.path === ('/organization/get-super-admin-table-data'),
handler: createAuthMiddleware(async (ctx) => {
try {
//do something

return { context: ctx }
} catch (error) {
//return api error
}
})
}
]
},
endpoints: {
getSuperAdminTableData: createAuthEndpoint(
"/organization/get-super-admin-table-data",
{
method: "GET",
query: getSuperAdminTableDataQuery,
},
async function getSuperAdminTableDataHandler(ctx): Promise<SuperAdminTableData[]> {
try {
//do something
} catch (error) {
return api error
}
}
)
},
} satisfies BetterAuthPlugin;
};
}
export const superAdminTableDataPlugin = () => {
return {
id: 'super-admin-table-data',
hooks: {
before: [
{
matcher: (ctx) => ctx.path === ('/organization/get-super-admin-table-data'),
handler: createAuthMiddleware(async (ctx) => {
try {
//do something

return { context: ctx }
} catch (error) {
//return api error
}
})
}
]
},
endpoints: {
getSuperAdminTableData: createAuthEndpoint(
"/organization/get-super-admin-table-data",
{
method: "GET",
query: getSuperAdminTableDataQuery,
},
async function getSuperAdminTableDataHandler(ctx): Promise<SuperAdminTableData[]> {
try {
//do something
} catch (error) {
return api error
}
}
)
},
} satisfies BetterAuthPlugin;
};
}
Then in auth-client.ts
export const superAdminTableDataClientPlugin = async () => {
return {
id: 'super-admin-table-data',
$InferServerPlugin : {} as ReturnType<typeof superAdminTableDataPlugin>,
getActions: async () => {}
} satisfies BetterAuthClientPlugin;
}
export const superAdminTableDataClientPlugin = async () => {
return {
id: 'super-admin-table-data',
$InferServerPlugin : {} as ReturnType<typeof superAdminTableDataPlugin>,
getActions: async () => {}
} satisfies BetterAuthClientPlugin;
}
============================================= Please help me clear this.
No description
Solution:
This topic was closed because return type cannot get handler and endpoint in server custom plugin function.
Jump to solution
1 Reply
Solution
birthdaycake7360
This topic was closed because return type cannot get handler and endpoint in server custom plugin function.

Did you find this page helpful?