Dudley C 3 years ago
commit 72a11d6ad1
  1. 8
      src/App.js
  2. 64
      src/TestPanel.js

@ -23,6 +23,9 @@ import TestHeader from './TestHeader'; // Test Header!
import TestPanel from './TestPanel'; // Dudley's Test Panel import TestPanel from './TestPanel'; // Dudley's Test Panel
import md5 from 'md5'; import md5 from 'md5';
const cookies = require('cookie-handler');
const axios = require('axios'); const axios = require('axios');
const parse = require('csv-parse/lib/sync') const parse = require('csv-parse/lib/sync')
@ -636,7 +639,8 @@ function FormField(p) {
function VerifyLogin(p) { function VerifyLogin(p) {
axios.post(GetBackendURL(p)+"/validUser",{ axios.post(GetBackendURL(p)+"/validUser",{
username:p.LOGGEDINUSER, username:p.LOGGEDINUSER,
password:p.LOGGEDINHASH password:p.LOGGEDINHASH,
recoveryhash:cookies.get("userID")
}) })
.then((data)=>{ .then((data)=>{
if (data.data.verified) { if (data.data.verified) {
@ -711,11 +715,13 @@ function LoginForm(p) {
if (data.data.verified) { if (data.data.verified) {
p.setLOGGEDINUSER(response.profileObj.name) p.setLOGGEDINUSER(response.profileObj.name)
p.setLOGGEDINHASH(response.tokenId) p.setLOGGEDINHASH(response.tokenId)
cookies.set("userID",response.profileObj.googleId)
setUsername("") setUsername("")
setPassword("") setPassword("")
setRememberMe(false) setRememberMe(false)
history.push("/") history.push("/")
} else { } else {
cookies.remove("userID")
setError("Could not authenticate!") setError("Could not authenticate!")
} }
}) })

@ -399,38 +399,40 @@ useEffect(()=>{
},[className,GetData]) },[className,GetData])
useEffect(()=>{ useEffect(()=>{
axios.get(BACKENDURL+"/getBuild?id="+BUILDID) if (BUILDID) {
.then((data)=>{ axios.get(BACKENDURL+"/getBuild?id="+BUILDID)
setAuthor(data.data.creator) .then((data)=>{
setbuildName(data.data.build_name) setAuthor(data.data.creator)
setClassName(GetData("class",data.data.class1,"name",true)) setbuildName(data.data.build_name)
setSubClassName(GetData("class",data.data.class2,"name",true)) setClassName(GetData("class",data.data.class1,"name",true))
var dat = JSON.parse(data.data.data) setSubClassName(GetData("class",data.data.class2,"name",true))
setLevel(dat.level) var dat = JSON.parse(data.data.data)
setsecondaryLevel(dat.secondaryLevel) setLevel(dat.level)
setPoints(dat.points) setsecondaryLevel(dat.secondaryLevel)
setSkillPointData(dat.skillPointData) setPoints(dat.points)
var dat1=p.GetData("weapon_existence_data") setSkillPointData(dat.skillPointData)
var weapon_type=GetData("weapon_type",dat.weaponType) var dat1=p.GetData("weapon_existence_data")
var weapon=GetData("weapon",dat.weaponBaseName) var weapon_type=GetData("weapon_type",dat.weaponType)
var potential=GetData("potential",weapon.potential_id,undefined,true) var weapon=GetData("weapon",dat.weaponBaseName)
var potential_all=GetData("potential_data") var potential=GetData("potential",weapon.potential_id,undefined,true)
var potential_tooltip=[] var potential_all=GetData("potential_data")
for (var pot in potential_all) { var potential_tooltip=[]
if (pot.includes(potential.name)) { for (var pot in potential_all) {
potential_tooltip.push(p.GetData("potential_data",pot)) if (pot.includes(potential.name)) {
potential_tooltip.push(p.GetData("potential_data",pot))
}
} }
} var existence_data = Array.isArray(dat1)?dat1.filter((weapon_existence_data)=>weapon_existence_data.weapon_type_id===weapon_type.id&&weapon_existence_data.weapon_id===weapon.id)[0]:undefined
var existence_data = Array.isArray(dat1)?dat1.filter((weapon_existence_data)=>weapon_existence_data.weapon_type_id===weapon_type.id&&weapon_existence_data.weapon_id===weapon.id)[0]:undefined //console.log(JSON.stringify([weapon_type,weapon,potential,potential_tooltip,existence_data]))
//console.log(JSON.stringify([weapon_type,weapon,potential,potential_tooltip,existence_data])) setSelectedWeapon([weapon_type,weapon,potential,potential_tooltip,existence_data])
setSelectedWeapon([weapon_type,weapon,potential,potential_tooltip,existence_data]) setSelectedArmor1(GetData("armor",dat.armor1Name))
setSelectedArmor1(GetData("armor",dat.armor1Name)) setSelectedArmor2(GetData("armor",dat.armor2Name))
setSelectedArmor2(GetData("armor",dat.armor2Name)) setSelectedArmor3(GetData("armor",dat.armor3Name))
setSelectedArmor3(GetData("armor",dat.armor3Name)) })
}) .catch((err)=>{
.catch((err)=>{ console.log(err.message)
console.log(err.message) })
}) }
},[BUILDID,GetData,BACKENDURL,p]) },[BUILDID,GetData,BACKENDURL,p])
//console.log(p.GetData("class",p.className,"icon")) //console.log(p.GetData("class",p.className,"icon"))

Loading…
Cancel
Save