pineafan | ff3d452 | 2022-05-06 19:51:02 +0100 | [diff] [blame] | 1 | import Axios from 'axios'; |
pineafan | c540da9 | 2021-09-03 20:33:36 +0100 | [diff] [blame] | 2 | |
pineafan | ff3d452 | 2022-05-06 19:51:02 +0100 | [diff] [blame] | 3 | const Validate = async (req, res) => { |
| 4 | try { |
TheCodedProf | f054b8c | 2023-03-03 15:32:19 -0500 | [diff] [blame] | 5 | var out = await Axios.get(`http://${process.env.NUCLEUS_CALLBACK}/verify/${req.body.code}`) |
pineafan | ff3d452 | 2022-05-06 19:51:02 +0100 | [diff] [blame] | 6 | out = out.data |
| 7 | let props = { |
| 8 | user: out.user, |
| 9 | role: out.role, |
| 10 | role_name: out.role_name, |
| 11 | guild: out.guild, |
| 12 | guild_name: out.guild_name, |
| 13 | guild_icon_url: out.guild_icon_url, |
| 14 | guild_size: out.guild_size |
| 15 | } |
| 16 | return res.status(200).send(props) |
| 17 | } catch (err) { |
| 18 | return res.status(400).end() |
| 19 | } |
pineafan | aed3024 | 2021-09-04 09:33:40 +0100 | [diff] [blame] | 20 | } |
| 21 | |
| 22 | export default Validate; |