Created
October 26, 2018 15:28
-
-
Save laniltee/afaeae229b434084678b8cbcab1e9d25 to your computer and use it in GitHub Desktop.
get token
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
function getTokenAndInject() { | |
$("#errorMessage").hide(); | |
axios.post('/tokens', {withCredentials: true}) | |
.then(response => { | |
$("#contentForm").append( | |
`<input type="text" hidden name="inputToken" id="inputToken" value=${response.data.token} />` | |
) | |
}) | |
.catch(error => { | |
$("#errorMessage").show(); | |
window.location.href = '/'; | |
}); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment