Created
March 13, 2022 19:30
-
-
Save john-zaprite/516960cb8d61d6c23a64908a48e05a4f to your computer and use it in GitHub Desktop.
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' | |
export default async (req: NextApiRequest, res: NextApiResponse) => { | |
const challenge = req.query.challenge | |
const LNESCROW_USER = process.env.LNESCROW_USER | |
const LNESCROW_PSWD = process.env.LNESCROW_PSWD | |
try { | |
const response = await ( | |
await fetch('https://api.satsarcade.com/getsession/', { | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/json', | |
}, | |
body: JSON.stringify({ | |
email: LNESCROW_USER, | |
password: LNESCROW_PSWD, | |
challenge: challenge, | |
}), | |
}) | |
).json() | |
res.status(200).json({ | |
data: response, | |
success: true, | |
}) | |
} catch (error) { | |
console.error('[ERROR] SA_TWO_002: Error checking challenge.', error) | |
res.status(error?.statusCode || 500).json({ | |
message: error?.message ?? error, | |
status: 'error', | |
success: false, | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment