Next.js Discord

Discord Forum

NextAuth and Multi-language

Unanswered
Brown bear posted this in #help-forum
Open in Discord
Brown bearOP
Hello community, I am using these two libraries.

As I have made the multilanguage following vercel it forces me that all my components are server components:
import 'server-only'
 
export type Locale = 'en' | 'es'
    

const dictionaries = {
  'en': () => import('../../dictionaries/en-US.json').then((module) => module.default),
  'es': () => import('../../dictionaries/es-ES.json').then((module) => module.default),
}
 
export const getDictionary = async (locale : Locale) => dictionaries[locale]()

the problem is that I am integrating login with nextauth and I get a button when going to api/auth/login
I don't want it to come out and I have read that using the onclick with SignIn(provider) avoids it, the problem is that I can't use that onclick because I have a server component.
What option do I have to go directly to the login without going through this button?

0 Replies