import axios from 'axios'; import {signIn} from "next-auth/react"; const strapiUrl = process.env.STRAPI_URL_API; export async function createJwtToken(email, password) { return await signIn('credentials', { redirect: false, email, password, }); } export async function signInStrapi({email, password}) { const res = await axios.post(`${strapiUrl}/auth/local`, { identifier: email, password, }); if (res && res.data) { const user = await axios.get(`${strapiUrl}/users/${res.data.user.id}?populate=deep`); if (user && user.data) { res.data.user = {...res.data.user, ...user.data}; } } return res.data; }