Created
January 31, 2018 14:55
-
-
Save mwhagedorn/823a76c0472b57d7953260f3d38dbb94 to your computer and use it in GitHub Desktop.
Weird bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The following works great: | |
sendEmail = () => { | |
this.setState({ isFetching: true }); | |
const params = { id: this.props.uid }; | |
api().post('/internal/invoices/emails', params) | |
.then((response) => { | |
this.props.reload(); | |
this.props.notify('success', response.data.message); | |
}) | |
.catch((error) => { | |
if (error.response.data.errors) { | |
this.props.notify('danger', error.response.data.errors[0]); | |
} else { | |
this.props.notify('danger', 'Unable to que up invoice email at this time'); | |
} | |
}) | |
.then(() => { | |
this.setState({ isFetching: false }); | |
this.hide(); | |
}); | |
}; | |
This code which is copied liberally from it does not: | |
getPublicInvoiceUrl = (uid) => { | |
this.setState({ isFetching: true }); | |
const params = { id: uid }; | |
console.log(params); | |
api().post('/internal/invoices/public_urls', params) | |
.then((response) => { | |
this.props.reload(); | |
this.setState({ | |
url: response.data.url | |
}); | |
}) | |
.catch((error) => { | |
if (error.response.data.errors) { | |
this.props.notify('danger', error.response.data.errors[0]); | |
} else { | |
this.props.notify('danger', 'Unable to get public invoice URL at this time.'); | |
} | |
}) | |
.then(() => { | |
this.setState({ isFetching: false }); | |
}); | |
}; | |
How it fails: In the second case, it doesnt append the ID to the route, i.e. /internal/invoices/public_urls instead of /internal/invoices/public_urls/<ID> | |
console.log proves that the hash { id: foo} has the correct values, and yet... fail |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment