log-in will be saved in sessionStorage

This commit is contained in:
knoxfighter 2017-08-23 22:58:07 +09:00
parent 2af47dc5ea
commit 3078264d71
2 changed files with 8 additions and 5 deletions

View File

@ -29,7 +29,6 @@ class Mod extends React.Component {
dataType: "JSON",
success: (data) => {
let newest_release = JSON.parse(data.data).releases[0];
console.log(newest_release);
if(newest_release.version != this.props.mod.version) {
this_class.setState({
newVersionAvailable: true,

View File

@ -17,10 +17,9 @@ class ModsContent extends React.Component {
this.updateModHandler = this.updateModHandler.bind(this);
this.state = {
username: "",
userKey: "",
username: sessionStorage.getItem("username") || "",
userKey: sessionStorage.getItem("userKey") || "",
installedMods: [],
updateInProgress: false
}
}
@ -58,9 +57,14 @@ class ModsContent extends React.Component {
type: "success"
});
let user_key = (JSON.parse(data.data))[0];
sessionStorage.setItem("username", username);
sessionStorage.setItem("userKey", user_key);
this.setState({
"username": username,
"userKey": (JSON.parse(data.data))[0]
"userKey": user_key
});
},
error: (jqXHR) => {