import { Component, Host, Event, h } from '@stencil/core';
import { FeedService } from '../../../services/feed.service';
import feedStore from '../../../stores/feed.store';
export class SparkleGww {
  constructor() {
    this.postComment = async (model) => {
      const result = await FeedService.getInstance().createPostComment(model);
      if (result.Succeeded) {
        this.commentPosted.emit();
      }
    };
  }
  async componentDidLoad() {
    await FeedService.getInstance().getAllPosts();
  }
  render() {
    console.log(feedStore.state.postIdLoading, "Loading");
    return (h(Host, null, feedStore.state.posts.map((item) => h("sparkle-gww-item", { key: item.Id, post: item, onPostComment: this.postComment, loading: feedStore.state.postIdLoading == item.Id }))));
  }
  static get is() { return "sparkle-gww"; }
  static get originalStyleUrls() { return {
    "$": ["sparkle-gww.css"]
  }; }
  static get styleUrls() { return {
    "$": ["sparkle-gww.css"]
  }; }
  static get events() { return [{
      "method": "commentPosted",
      "name": "commentPosted",
      "bubbles": true,
      "cancelable": true,
      "composed": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "complexType": {
        "original": "any",
        "resolved": "any",
        "references": {}
      }
    }]; }
}
