mirror of
https://github.com/RoboSats/robosats.git
synced 2024-12-13 19:06:26 +00:00
fix async user generation
This commit is contained in:
parent
229294b878
commit
aa8e1f50a2
@ -26,7 +26,7 @@ export default class UserGenPage extends Component {
|
||||
this.state = {
|
||||
token: this.genBase62Token(32),
|
||||
};
|
||||
this.getGeneratedUser();
|
||||
this.getGeneratedUser(this.state.token);
|
||||
}
|
||||
|
||||
// sort of cryptographically strong function to generate Base62 token client-side
|
||||
@ -40,8 +40,8 @@ export default class UserGenPage extends Component {
|
||||
.substring(0, length);
|
||||
}
|
||||
|
||||
getGeneratedUser() {
|
||||
fetch('/api/user' + '?token=' + this.state.token)
|
||||
getGeneratedUser(token) {
|
||||
fetch('/api/user' + '?token=' + token)
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
this.setState({
|
||||
@ -82,7 +82,7 @@ export default class UserGenPage extends Component {
|
||||
this.setState({
|
||||
token: e.target.value,
|
||||
})
|
||||
this.getGeneratedUser();
|
||||
this.getGeneratedUser(e.target.value);
|
||||
}
|
||||
|
||||
// TO FIX CSRF TOKEN IS NOT UPDATED UNTIL WINDOW IS RELOADED
|
||||
|
Loading…
Reference in New Issue
Block a user