import { dbConnection } from "db";
import type { NextApiRequest, NextApiResponse } from "next";

export default async function handler(
  req: NextApiRequest,
  res: NextApiResponse
) {
  try {
    if (req.method === "POST") {
      const { wallet } = req.body;
      // const db = await dbConnection;
      // const user = await db.get("SELECT id FROM users WHERE wallet = ?", [wallet]);

      // Comment me out
      return res.status(200).json({ userId: 1});
      
      /* if (user != undefined) {
        return res.status(200).json({ userId: user.id});
      } else {
        return res.status(404).json({ message: "User not found" });
      } */
    }
  } catch (error) {
    res.status(500).json(error);
  }
}
