How to use the gatsby.navigate function in gatsby

To help you get started, we’ve selected a few gatsby examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github baobabKoodaa / blog / src / components / Contact / Contact.js View on Github external
.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 => {
github pathwar / pathwar / web / src / pages / LogoutPage.js View on Github external
componentDidMount() {
        const { userSession, logoutUserAction } = this.props;

        if (!userSession.activeKeycloakSession) {
            navigate("/");
        } else {
          userSession.activeKeycloakSession.logout();
          logoutUserAction();
        }
    }
github moetezch / moetez.me / src / pages / contact.js View on Github external
                .then(() => navigate('/message'))
                .catch(error => alert(error))
github jrestall / gatsby-orchardcore / packages / gatsby-theme-orchardcore-localization / src / link.js View on Github external
export const navigate = (to, options) => {
  if (typeof window === "undefined") {
    return
  }

  const { language, routed } = window.___gatsbyIntl
  const link = routed ? `/${language}${to}` : `${to}`
  gatsbyNavigate(link, options)
}
github pomber / gatsby-theme-deck-n-blog / theme / src / gatsby-theme-blog / templates / posts.js View on Github external
export default () => {
  if (typeof window !== "undefined") {
    navigate("/")
  }
  return ""
}
github thirdandgrove / thirdandgrove-com-gatsby / src / components / ProjectPreview / ProjectPreview.js View on Github external
      <button> navigate(ensureTrailingSlash(project.path.alias))}&gt;
        View Case Study</button>
github gil-- / gatsby-starter-shopify-app / src / helpers / auth.js View on Github external
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
}
github pathwar / pathwar / web / src / components / SiteWrapper.js View on Github external
                <button> navigate("/app/logout")}&gt;
                  Log out</button>