-
-
Save vpaladino778/92dbe6191f31d237baf0249794ddeec9 to your computer and use it in GitHub Desktop.
api/login.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NextApiRequest, NextApiResponse } from 'next'; | |
import { setAuthCookies } from 'next-firebase-auth'; | |
import initAuth from '../../service/auth/initAuth'; | |
initAuth(); | |
const handler = async (req: NextApiRequest, res: NextApiResponse<any>) => { | |
try { | |
await setAuthCookies(req, res); | |
} catch (e) { | |
return res.status(500).json({ error: 'Unexpected error.' }); | |
} | |
return res.status(200).json({ success: true }); | |
}; | |
export default handler; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment