| 1234567891011121314151617181920212223242526 |
- import axios from "axios";
- import type { NextApiHandler } from "next";
- const loginHandler: NextApiHandler = async (req, res) => {
- if (req.body) {
- try {
- const response = await axios.post(
- `${process.env.PRISMA_API}/login`,
- req.body,
- { headers: { "Content-Type": "application/json" } }
- );
- res.status(response.status).json(response.data);
- } catch (e) {
- if (axios.isAxiosError(e)) {
- res.status(e.response?.status || 500).json(e.response?.data);
- } else {
- res.status(500).json({
- message:
- "There was an error processing the request, please try again.",
- });
- }
- }
- }
- };
- export default loginHandler;
|