fix: remove history from register component, use gatsby's navigate
This commit is contained in:
@@ -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 })
|
||||||
|
|||||||
Reference in New Issue
Block a user