Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Commit

Permalink
feat(NewsletterWidget): update for new API
Browse files Browse the repository at this point in the history
  • Loading branch information
CanRau committed Oct 23, 2020
1 parent 12c8ab7 commit ced6ac7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/components/NewsletterWidget/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import localStore from '@src/utils/local-store'
import { request } from '@src/utils/request'
import { Link } from '@components/Link'

const StyledInput = props => (
const StyledInput = (props) => (
<input
sx={{
width: `100%`,
Expand Down Expand Up @@ -90,9 +90,9 @@ export class Newsletter extends Component {
this.setState({ attempts: this.state.attempts + 1 })
}

hasErrors = () => Object.values(this.state.errors).filter(x => x).length
hasErrors = () => Object.values(this.state.errors).filter((x) => x).length

handleChange = event => {
handleChange = (event) => {
const target = event.target
const value =
target.type === `checkbox`
Expand All @@ -111,7 +111,7 @@ export class Newsletter extends Component {
)
}

handleSubmit = event => {
handleSubmit = (event) => {
if (typeof window === `undefined`) {
return this.setState({ generalError: this.props.generalErrorLabel })
}
Expand Down Expand Up @@ -153,9 +153,9 @@ export class Newsletter extends Component {
]

return request
.post(this.props.endpoint, payload.join('&'))
.then(result => {
if (result === 'Ok!') {
.post(this.props.endpoint, payload.join(`&`))
.then((result) => {
if (result === `Ok`) {
this.reset()
localStore.removeItem(`NewsletterForm`)
return this.setState({ hasSucceeded: true }, () => {
Expand Down

0 comments on commit ced6ac7

Please sign in to comment.