Skip to content

Commit 39c8b82

Browse files
committed
refactor: simplify socialProvidersPlugin by removing nested function and condensing return
1 parent b138aff commit 39c8b82

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

packages/auth/src/auth.ts

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,23 +74,18 @@ export const configuredProviders = socialProviderList.reduce<
7474
return acc;
7575
}, {});
7676

77-
export const socialProvidersPlugin = () => {
78-
return {
79-
id: "social-providers-plugin",
80-
endpoints: {
81-
getSocialProviders: createAuthEndpoint(
82-
"/social-providers",
83-
{
84-
method: "GET",
85-
},
86-
async (ctx) => {
87-
const providers = ctx.context.socialProviders.map(p => p.name.toLowerCase());
88-
return ctx.json(providers);
89-
},
90-
),
91-
},
92-
};
93-
};
77+
export const socialProvidersPlugin = () => ({
78+
id: "social-providers-plugin",
79+
endpoints: {
80+
getSocialProviders: createAuthEndpoint(
81+
"/social-providers",
82+
{
83+
method: "GET",
84+
},
85+
async (ctx) => ctx.json(ctx.context.socialProviders.map(p => p.name.toLowerCase())),
86+
),
87+
},
88+
});
9489

9590
export const initAuth = (db: dbClient) => {
9691
return betterAuth({

0 commit comments

Comments
 (0)