mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-01-13 16:37:58 -05:00
27 lines
581 B
TypeScript
27 lines
581 B
TypeScript
import {
|
|
NextApiRequest as NextAPIRequest,
|
|
NextApiResponse as NextAPIResponse,
|
|
} from 'next';
|
|
|
|
import { getSession } from '#lib/ironSession';
|
|
|
|
const handler = async (
|
|
req: NextAPIRequest,
|
|
res: NextAPIResponse,
|
|
): Promise<void> => {
|
|
const { method } = req;
|
|
switch (method) {
|
|
case 'GET': {
|
|
const session = await getSession(req, res);
|
|
res.send({ address: session.siwe?.data.address });
|
|
break;
|
|
}
|
|
default: {
|
|
res.setHeader('Allow', ['GET']);
|
|
res.status(405).end(`Method ${method} Not Allowed`);
|
|
}
|
|
}
|
|
};
|
|
|
|
export default handler;
|