pineafan | c540da9 | 2021-09-03 20:33:36 +0100 | [diff] [blame] | 1 | import Axios from 'axios'; |
| 2 | |
pineafan | aed3024 | 2021-09-04 09:33:40 +0100 | [diff] [blame] | 3 | const Complete = async (req, res) => { |
pineafan | c540da9 | 2021-09-03 20:33:36 +0100 | [diff] [blame] | 4 | let code = await Axios.post('http://localhost:3000/api/rsmv/validate', {code:req.body.code}); |
pineafan | 98f4297 | 2021-09-04 10:01:56 +0100 | [diff] [blame] | 5 | console.log("1") |
pineafan | c540da9 | 2021-09-03 20:33:36 +0100 | [diff] [blame] | 6 | if (code.status != 200) { |
| 7 | return res.send(404); |
| 8 | } |
pineafan | 98f4297 | 2021-09-04 10:01:56 +0100 | [diff] [blame] | 9 | console.log("2") |
pineafan | c540da9 | 2021-09-03 20:33:36 +0100 | [diff] [blame] | 10 | if (code.data.user != req.body.uid) return res.send(401) |
| 11 | if (code.data.guild != req.body.gid) return res.send(401) |
| 12 | if (code.data.role != req.body.rid) return res.send(401) |
pineafan | 98f4297 | 2021-09-04 10:01:56 +0100 | [diff] [blame] | 13 | console.log("3") |
| 14 | |
pineafan | c540da9 | 2021-09-03 20:33:36 +0100 | [diff] [blame] | 15 | let secret = "slwu0rZV5W6WdmGtgI16du8Ar2tQGMr3Q9dE6u3poKiVODNV9SweaA3buawgkTmTuITXDWOUpBcTFA0qWrUvoshi1JB180WOFwA7" |
| 16 | let resp = await Axios.get( |
| 17 | `http://192.168.102.5:10000/role/gid/${req.body.gid}/rid/${req.body.rid}/user/${req.body.uid}/secret/${secret}/code/${req.body.code}` |
pineafan | 98f4297 | 2021-09-04 10:01:56 +0100 | [diff] [blame] | 18 | ) |
| 19 | console.log("4") |
pineafan | c540da9 | 2021-09-03 20:33:36 +0100 | [diff] [blame] | 20 | return res.send(resp.status); |
| 21 | } |
pineafan | aed3024 | 2021-09-04 09:33:40 +0100 | [diff] [blame] | 22 | |
| 23 | export default Complete; |