Skip to content

Commit

Permalink
fix(auth): loadRouters
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien2p committed Jan 4, 2024
1 parent 4a2a2f4 commit 356fff4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/medusa-plugin-auth/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@ import AzureStrategy from '../auth-strategies/azure-oidc';

import { AuthOptions, AuthOptionsWrapper, handleOption } from '../types';

export default async function (rootDirectory, pluginOptions: AuthOptions[]): Promise<Router[]> {
export default async function (rootDirectory, pluginOptions: AuthOptions | AuthOptions[]): Promise<Router[]> {
const configModule = loadConfig(rootDirectory);
return loadRouters(configModule, pluginOptions);
}

async function loadRouters(configModule: ConfigModule, options: AuthOptionsWrapper[]): Promise<Router[]> {
async function loadRouters(
configModule: ConfigModule,
options: AuthOptionsWrapper | AuthOptionsWrapper[]
): Promise<Router[]> {
const routers: Router[] = [];

for (const opt of options) {
const options_ = Array.isArray(options) ? options : [options];
for (const opt of options_) {
const option = await handleOption(opt, configModule);

switch (option.type) {
Expand Down

1 comment on commit 356fff4

@vercel
Copy link

@vercel vercel bot commented on 356fff4 Jan 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

medusa-plugins – ./

medusa-plugins-git-main-adrien2p.vercel.app
medusa-plugins.vercel.app
medusa-plugins-adrien2p.vercel.app

Please sign in to comment.