AuthActions.register({ username: submission.formData.username, password: submission.formData.password, host: submission.formData.rtorrentHost, port: submission.formData.rtorrentPort, socketPath: submission.formData.rtorrentSocketPath, isAdmin: true, }).then(() => { this.setState({isSubmitting: false}, () => history.replace('overview')); });
logout() { // Clear access token and ID token from local storage localStorage.removeItem('access_token'); localStorage.removeItem('id_token'); localStorage.removeItem('expires_at'); this.userProfile = null; console.log("Logged Out") // navigate to the home route history.replace('/authcheck') }
setSession(authResult) { // Set the time that the access token will expire at let expiresAt = JSON.stringify( authResult.expiresIn * 1000 + new Date().getTime() ); localStorage.setItem('access_token', authResult.accessToken); // localStorage.setItem('id_token', authResult.idToken); localStorage.setItem('expires_at', expiresAt); // navigate to the home route history.replace('/home'); }
send_profile_to_db (profile) { const data = profile axios.post('api/post/userprofiletodb', data) .then(() => axios.get('api/get/userprofilefromdb', {params: {email: profile.profile.email}} ) .then(res => this.props.db_profile_success(res.data)) .then(history.replace('/'))) }
componentWillMount() { if (localStorage.getItem('token')) { history.replace('/'); } }
function FacebookCallback() { const history = useHistory(); const search = window.location.hash; const query = new URLSearchParams(search.slice(1)); localStorage.setItem("facebook-token", query.get("access_token")); history.replace("/"); return <div>Facebook</div>; }
fetch(`${CONNECTION}/user/logout`, { credentials: 'include' }).then(response => response.json()) .then(() => { this.loggedIn = false; history.replace('/'); });
axios.post('api/post/poststodb', data) .then(response => console.log(response)) .catch(function (error) { console.log(error); }) .then(setTimeout( function() { history.replace('/') }, 700))
function setSession(authResult) { let expiresAt = JSON.stringify( authResult.expiresIn * 1000 + new Date().getTime() ) localStorage.setItem('access_token', authResult.accessToken) localStorage.setItem('id_token', authResult.idToken) localStorage.setItem('expires_at', expiresAt) // navigate to the home route history.replace('/') }
logout() { // Clear access token and ID token from local storage localStorage.removeItem('access_token'); localStorage.removeItem('id_token'); localStorage.removeItem('expires_at'); localStorage.removeItem('profile') // navigate to the home route history.replace('/'); }
axios.post('/api/post/commenttodb', data) .then(res => console.log(res)) .catch(function (error) { console.log(error); }) .then(setTimeout( function() { history.replace('/posts') }, 700))
function GoogleCallback() { const history = useHistory(); const search = window.location.hash; const query = new URLSearchParams(search.slice(1)); localStorage.setItem("google-token", query.get("access_token")); history.replace("/"); return <div>Google</div>; }