Next.js Discord

Discord Forum

how to use redux with the nextJS tutorial?

Unanswered
Le Conte's Sparrow posted this in #help-forum
Open in Discord
Le Conte's SparrowOP
Hello,

I would like to pass a dispatch function to the signIn function of the NextAuth of the auth.ts file. See below.

Is it something doable?

export const { auth, signIn, signOut } = NextAuth({
...authConfig,
providers: [
Credentials({
async authorize(credentials) {
const parsedCredentials = z
.object({ phone: z.string(), password: z.string().min(3) })
.safeParse(credentials);

if (parsedCredentials.success) {
console.log('parsedCredentials', parsedCredentials);
const { phone, password } = parsedCredentials.data;
const payload = { identification: phone, password: password };
const [success, message, token] = await loginOnline(payload);

// dispatch({ type: SET_JWT_TOKEN, payload: token });

console.log('========= success', success, message);
if (success)
return { identification: phone, name: 'John Doe', token: token };
// if (!user) return null;
// const passwordsMatch = await bcrypt.compare(password, user.password);
// if (passwordsMatch) return user;
}

return null;
},
}),
],
});

0 Replies