import Axios from 'axios';
import qs from 'querystring';

const Complete = async (req, res) => {
    const chk = await Axios.post('https://hcaptcha.com/siteverify', qs.stringify({
        response: req.body.tkn,
        secret: '0x19C699BFfce07b2a026121DE6702706BB2d51D6c',
        sitekey: '85074411-fa13-4d9b-b901-53095c6d1fc6'
    }))
    if ( !chk.data.success ) {
        return res.status(200).send({success: false})
    }
    try {
        await Axios.post(`http://${process.env.NUCLEUS_CALLBACK}/verify/${req.body.code}`, {
            secret: process.env.VERIFY_SECRET
        });
    } catch (e) {
        return res.status(200).send({success: false})
    }
    return res.status(200).send({success: true});
}

export default Complete;