Saving implemented (no loading yet)
This commit is contained in:
parent
81dd37a4b3
commit
a83ebcbe83
@ -809,6 +809,7 @@ function App() {
|
||||
|
||||
const [LOGGEDINUSER,setLOGGEDINUSER] = useState("")
|
||||
const [LOGGEDINHASH,setLOGGEDINHASH] = useState("")
|
||||
const [BUILDID,setBUILDID] = useState(undefined)
|
||||
|
||||
function GetData(table,row,col,id){
|
||||
if (row===undefined) {row=''}
|
||||
@ -885,6 +886,10 @@ function App() {
|
||||
poisonResist={poisonResist}
|
||||
statDisplayAtk={statDisplayAtk}
|
||||
GetData={GetData}
|
||||
LOGGEDINUSER={LOGGEDINUSER}
|
||||
BUILDID={BUILDID}
|
||||
setBUILDID={setBUILDID}
|
||||
BACKENDURL={GetBackendURL(BACKENDURL)}
|
||||
/>
|
||||
</Route>
|
||||
<Route path={process.env.PUBLIC_URL+"/login"}>
|
||||
|
@ -3,6 +3,7 @@ import Modal from 'react-modal'
|
||||
import { DisplayIcon } from './DEFAULTS';
|
||||
import { ExpandTooltip } from './components/ExpandTooltip';
|
||||
import { SkillTree } from './skilltree/skillTree';
|
||||
import axios from 'axios';
|
||||
|
||||
//Helper variables for Weapon selector with structure: [weapon_type,weapon,potential,potential_tooltip,weapon_existence_data]
|
||||
const WEAPON_WEAPONTYPE=0;const WEAPON_WEAPON=1;const WEAPON_POTENTIAL=2;const WEAPON_POTENTIAL_TOOLTIP=3;const WEAPON_EXISTENCE_DATA=4;
|
||||
@ -287,7 +288,7 @@ function SkillTreeContainer(p){
|
||||
|
||||
function TestPanel(p) {
|
||||
|
||||
const { GetData } = p
|
||||
const { GetData,LOGGEDINUSER,BUILDID,BACKENDURL,setBUILDID } = p
|
||||
|
||||
const [bpGraphMax,setbpGraphMax] = useState(1000)
|
||||
const [hpGraphMax,sethpGraphMax] = useState(1000)
|
||||
@ -325,20 +326,27 @@ const [skillPointData,setSkillPointData] = useState([])
|
||||
|
||||
function SaveData() {
|
||||
var saveObj = {
|
||||
author:author,
|
||||
buildName:buildName,
|
||||
className:className,
|
||||
subclassName:subclassName,
|
||||
level:level,
|
||||
secondaryLevel:secondaryLevel,
|
||||
weaponId:selectedWeapon[WEAPON_WEAPON].id,
|
||||
armor1Id:selectedArmor1.id,
|
||||
armor2Id:selectedArmor2.id,
|
||||
armor3Id:selectedArmor3.id,
|
||||
weaponBaseName:selectedWeapon[WEAPON_WEAPON]?.name,
|
||||
weaponType:selectedWeapon[WEAPON_WEAPONTYPE]?.name,
|
||||
armor1Name:selectedArmor1?.name,
|
||||
armor2Name:selectedArmor2?.name,
|
||||
armor3Name:selectedArmor3?.name,
|
||||
points:points,
|
||||
skillPointData:skillPointData
|
||||
skillPointData:skillPointData,
|
||||
}
|
||||
console.log(saveObj)
|
||||
axios.post(BACKENDURL+"/submitBuild",{
|
||||
id:BUILDID,
|
||||
username:LOGGEDINUSER,
|
||||
creator:author,
|
||||
build_name:buildName,
|
||||
class1:className,
|
||||
class2:subclassName,
|
||||
data:JSON.stringify(saveObj),})
|
||||
.then((data)=>{
|
||||
setBUILDID(data.data.id)
|
||||
})
|
||||
}
|
||||
|
||||
function rarityCheck(v) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user