# 첫 번째 게시물 뒤에 Glimmer 컴포넌트 삽입

**URL:** <https://meta.discourse.org/t/insert-a-glimmer-component-after-first-post/303282>\
**Category:** Development\
**Created:** [4월 10, 2024, 6:19오후 UTC](https://meta.discourse.org/t/insert-a-glimmer-component-after-first-post/303282 "2024-04-10T18:19:56Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [4월 16, 2024, 3:20오후 UTC](https://meta.discourse.org/t/insert-a-glimmer-component-after-first-post/303282/8 "2024-04-16T15:20:31Z")

</div>

거의 다 됐어요!

유일한 문제는 `currentUser`를 컴포넌트에 전달하는 방법을 모르겠는 겁니다. 아래는 작동하지 않는 코드입니다.

```plaintext
import { hbs } from "ember-cli-htmlbars";
import { withPluginApi } from "discourse/lib/plugin-api";
import Site from "discourse/models/site";
import { registerWidgetShim } from "discourse/widgets/render-glimmer";
import Banner from "../components/banner";

export default {
  name: "initialize-banner-widget",
  initialize(container) {
    registerWidgetShim(
      "geo-banner-widget",
      "div.widget-connector",
      hbs`<Banner @currentUser={{currentUser}} />`
    );

    // withPluginApi("0.1", (api) => {
    // console.log("doing plugin");
    // api.decorateWidget("post:after", (helper) => {
    // return helper.attach("geo-banner-widget", helper.widget.model);
    // });
    // });

    withPluginApi("0.1", (api) => {
      const currentUser = container.lookup("service:current-user");
      api.decorateWidget("post:after", (helper) => {
        console.log(`decorate widget ${currentUser.username}`, );
        if(helper.widget.model.post_number === 1){
          return helper.attach("geo-banner-widget", { currentUser });
        }
      });
    });
  },
};

```

---

_[View the full topic](https://meta.discourse.org/t/insert-a-glimmer-component-after-first-post/303282)._
