Every line of 'react redirect to another page' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
76 export function redirect( context ) { 77 const state = context.store.getState(); 78 const siteId = getSelectedSiteId( state ); 79 if ( siteId ) { 80 page.redirect( '/activity-log/' + siteId ); 81 return; 82 } 83 page.redirect( '/activity-log/' ); 84 }
68 function redirect(text = null) { 69 if (text == null) { 70 text = document.querySelector('#search-box').value; 71 } 72 location.href = '/?q=' + encodeURIComponent(text); 73 }
86 function Redirect({panes}) { 87 const router = useRouter() 88 89 useEffect(() => { 90 router.navigate({panes}, {replace: true}) 91 }) 92 93 return 94 }
25 async act() { 26 this._globals.redirect(this.get('path')); 27 }
19 handleRedirect() { 20 const { location, history, currentUser, ready } = this.props; 21 const { state: routerState = {}, ...locationWithoutState } = location; 22 const allowedAccessLevels = ['reporting', 'heroku', 'azure', 'marketing']; 23 24 // if there is a redirect route set on state, we can 25 // redirect there before access condition state is ready 26 if (routerState.redirectAfterLogin) { 27 history.replace({ ...locationWithoutState, ...routerState.redirectAfterLogin }); 28 return; 29 } 30 31 // if access condition state hasn't loaded, we can't 32 // make a redirect decision yet 33 if (!ready) { 34 return; 35 } 36 37 // reporting users are all sent to the summary report 38 if (_.includes(allowedAccessLevels, currentUser.access_level)) { 39 history.replace({ ...location, pathname: '/reports/summary' }); 40 return; 41 } 42 43 // everyone else is sent to the config.splashPage route 44 history.replace({ ...location, pathname: config.splashPage }); 45 }
25 redirect(): void { 26 const { 27 session: { isAuthenticated } 28 } = this; 29 if (isAuthenticated) { 30 this.transitionTo('index'); 31 } 32 }
238 handleRedirect(item) { 239 if (item.key) { 240 router.locator.redirect(item.key); 241 } 242 }
50 function redirect() 51 { 52 if (second < 0) 53 { 54 55 location.href = '/sba'; 56 } else 57 { 58 if (navigator.appName.indexOf("Explorer") > -1) 59 { 60 document.getElementById('totalSecond').innerText = second--; 61 } else 62 { 63 document.getElementById('totalSecond').textContent = second--; 64 } 65 } 66 }
156 redirect(redirect) { 157 if (this.disabled) return this; 158 this.state.redirect = redirect; 159 return this; 160 }
57 redirect(path, saveInHistory = false) { 58 if (DEBUG) console.log('ReactApp.redirect', path); 59 setTimeout(() => { 60 if (saveInHistory) { 61 this.history.replace(path); 62 } else { 63 this.history.push(path); 64 } 65 }, DEBUG ? 1000 : 0); 66 }