Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(function(response) {
console.log(response)
if (response.result == 'success') {
console.log("Form submission success");
navigate("/success");
} else {
console.error(response);
alert("Server responded with error! Sorry about this.")
}
})
.catch(error => {
componentDidMount() {
const { userSession, logoutUserAction } = this.props;
if (!userSession.activeKeycloakSession) {
navigate("/");
} else {
userSession.activeKeycloakSession.logout();
logoutUserAction();
}
}
.then(() => navigate('/message'))
.catch(error => alert(error))
onClick={() => {
navigate('/2019/#location')
}}
>
export const navigate = (to, options) => {
if (typeof window === "undefined") {
return
}
const { language, routed } = window.___gatsbyIntl
const link = routed ? `/${language}${to}` : `${to}`
gatsbyNavigate(link, options)
}
export default () => {
if (typeof window !== "undefined") {
navigate("/")
}
return ""
}
<button> navigate(ensureTrailingSlash(project.path.alias))}>
View Case Study</button>
const queryParams = urlParamString
|| window.location.search
|| cookies.get('hmac_query')
const urlParams = new URLSearchParams(queryParams)
const shop = urlParams.get('shop')
const token = urlParams.get('token')
const expiresAt = urlParams.get('expires_at')
const uid = urlParams.get('uid')
if (isAuthValid({ token, expiresAt, uid })) {
return true
} else {
const shopifyDomain = shop || getShopDomain()
if (!shopifyDomain) {
navigate('/install')
return false
//throw "No Shop domain"
}
return await refreshAuth(shopifyDomain)
}
return false
}
const navigateTo = route => () => {
onCloseMenu();
navigate(route);
};
<button> navigate("/app/logout")}>
Log out</button>