fix: remove history from register component, use gatsby's navigate

This commit is contained in:
Kyle Gill
2019-05-16 09:30:27 -06:00
parent b9bedd314a
commit c383e8899e

View File

@@ -1,5 +1,6 @@
import React, { Component } from "react" import React, { Component } from "react"
import styled from "@emotion/styled" import styled from "@emotion/styled"
import { navigate } from "gatsby"
import { compose } from "recompose" import { compose } from "recompose"
import { withTheme } from "emotion-theming" import { withTheme } from "emotion-theming"
@@ -21,10 +22,10 @@ const RegisterLayout = styled.div`
margin-top: 20px; margin-top: 20px;
` `
const RegisterPage = ({ history, theme }) => ( const RegisterPage = ({ theme }) => (
<RegisterLayout> <RegisterLayout>
<FirebaseContext.Consumer> <FirebaseContext.Consumer>
{firebase => <RegisterForm history={history} firebase={firebase} />} {firebase => <RegisterForm firebase={firebase} />}
</FirebaseContext.Consumer> </FirebaseContext.Consumer>
<P colors={theme.colors} style={{ fontStyle: "italic" }}> <P colors={theme.colors} style={{ fontStyle: "italic" }}>
Already have an account? <Link to={"/login"}>Login</Link> Already have an account? <Link to={"/login"}>Login</Link>
@@ -68,7 +69,7 @@ class RegisterFormBase extends Component {
.set({ .set({
email: user.email, email: user.email,
}) })
this.props.history.push("/") navigate("app/")
}) })
.catch(error => { .catch(error => {
this.setState({ error }) this.setState({ error })