Skip to content

Add pnpm workspaces and improve Nuxt example#1

Open
wobsoriano wants to merge 4 commits intonextauthjs:mainfrom
wobsoriano:pnpm-workspace
Open

Add pnpm workspaces and improve Nuxt example#1
wobsoriano wants to merge 4 commits intonextauthjs:mainfrom
wobsoriano:pnpm-workspace

Conversation

@wobsoriano
Copy link
Member

@wobsoriano wobsoriano commented Jun 30, 2024

Hey all! It's been a long time since my last PR here. I noticed we have a new repo for playgrounds, which is great since the main repo was starting to get crowded with playgrounds. Love it.

I'm opening a PR here to add an initial working example with pnpm workspaces. I've simplified the Nuxt playground by taking advantage of the built-in web Request and Response helpers:

export function NuxtAuthHandler(authOptions: AuthConfig) {
  return eventHandler(async (event) => {
    const request = toWebRequest(event) // h3 event to standard Request

    const url = new URL(request.url)
    const action = url.pathname
      .slice(authOptions.basePath!.length + 1)
      .split('/')[0] as AuthAction

    if (isAuthAction(action) && !url.pathname.startsWith(authOptions.basePath + '/')) {
      return
    }

    return await Auth(request, authOptions) // Nuxt now accepts a Response as a return value!
  })
}

I did not touch the gatsby example - don't really have experience with it.

Copy link
Member Author

@wobsoriano wobsoriano Jun 30, 2024

Choose a reason for hiding this comment

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

This is the 19k line change that can be ignored :p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant