Open FluorescentHallucinogen opened 6 years ago
If I use plain Firebase JavaScript SDK API, I deal with JS promises and can easily handle success and errors:
firebase.database().ref(`/posts/${postId}`).set({ body: text }).then(response => { // do something }).catch(error => { // handle error });
But if I use e.g. <firebase-document>, how do I know if the data was successfully written to the database or an error occurred (and which one)?:
<firebase-document>
<firebase-document path="/posts/[[postId]]/body" data="{{text}}"> </firebase-document>
Seems, only <firebase-auth> web component can fire error events:
<firebase-auth>
error
<firebase-auth provider="google" user="{{user}}" on-error="handleError"> </firebase-auth>
But error event is not listed in https://webcomponents.org/element/firebase/polymerfire/elements/firebase-auth#events.
The following JSDoc annotation should be added to <firebase-auth> source code to fix it:
/** * Fired when an error occurs. * * @event error * @param {Object} The returned error object. */
What about adding error events to other PolymerFire web components? And how to handle success? What about adding success events?
success
@tjmonsi @mbleigh PTAL.
@merlinnot PTAL.
If I use plain Firebase JavaScript SDK API, I deal with JS promises and can easily handle success and errors:
But if I use e.g.
<firebase-document>
, how do I know if the data was successfully written to the database or an error occurred (and which one)?:Seems, only
<firebase-auth>
web component can fireerror
events:But
error
event is not listed in https://webcomponents.org/element/firebase/polymerfire/elements/firebase-auth#events.The following JSDoc annotation should be added to
<firebase-auth>
source code to fix it:What about adding
error
events to other PolymerFire web components? And how to handle success? What about addingsuccess
events?