()
| 25 | } |
| 26 | |
| 27 | render() { |
| 28 | const { isPending, isError, isFetching, data, error } = this.post() |
| 29 | |
| 30 | return html` |
| 31 | <div> |
| 32 | <div> |
| 33 | <a href="#posts" @click=${this.back}>Back</a> |
| 34 | </div> |
| 35 | ${ |
| 36 | !this.postId || isPending |
| 37 | ? html`<div>Loading...</div>` |
| 38 | : isError |
| 39 | ? html`<span>Error: ${error.message}</span>` |
| 40 | : html` |
| 41 | <h1>${data.title}</h1> |
| 42 | <div> |
| 43 | <p>${data.body}</p> |
| 44 | </div> |
| 45 | <div>${isFetching ? 'Background Updating...' : ' '}</div> |
| 46 | ` |
| 47 | } |
| 48 | </div> |
| 49 | ` |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | customElements.define('post-detail', PostDetail) |
nothing calls this directly
no outgoing calls
no test coverage detected