Skip to content

Instantly share code, notes, and snippets.

@jclk86
Created October 2, 2019 02:07
Show Gist options
  • Save jclk86/12c2dee2c5b4bfa7a28b65bd4b917e86 to your computer and use it in GitHub Desktop.
Save jclk86/12c2dee2c5b4bfa7a28b65bd4b917e86 to your computer and use it in GitHub Desktop.
JWTPAYLOAD
handleSubmitBasicAuth = event => {
event.preventDefault();
this.setState({ error: null });
const { username, password } = event.target;
AuthApiService.postLogin({
username: username.value,
password: password.value
})
.then(res => {
// Retrieves user id from payload.
const userId = res.id.id; <--- user_id passed from my JWT PAYLOAD
username.value = "";
password.value = "";
this.props.onLoginSuccess(userId);
})
.catch(res => {
this.setState({ error: res.error });
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment