# showModal 컨트롤러에서 post-id와 user를 가져오는 방법은?

**URL:** https://meta.discourse.org/t/how-can-i-get-post-id-user-in-showmodal-controller/258369
**Category:** Development
**Created:** [3월 16, 2023, 12:29오후 UTC](https://meta.discourse.org/t/how-can-i-get-post-id-user-in-showmodal-controller/258369 "2023-03-16T12:29:03Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![bstgmr02](https://avatars.discourse-cdn.com/v4/letter/b/858c86/32.png) [@bstgmr02](https://meta.discourse.org/u/bstgmr02)
#### Post date: [3월 16, 2023, 12:29오후 UTC](https://meta.discourse.org/t/how-can-i-get-post-id-user-in-showmodal-controller/258369/1 "2023-03-16T12:29:03Z")

</div>

아래는 제 초기화 코드입니다:

```js
export default {
    name: 'customInit',
    initialize() {      
        withPluginApi('0.8.7', api => {             
            api.attachWidgetAction('post', 'showCustomModal', () => {
                const modal = showModal('customModal');
            });
                
            api.addPostMenuButton('customBtn', (attrs) => {                
                return {
                    data: {
                        "post-id": attrs.id,
                        "user": attrs.username
                    },
                    action: 'showCustomModal',
                    icon: 'hand-holding-usd',
                    className: 'custom-btn',
                    title: 'custom_icon_anchor',
                    position: 'first' 
                };
            });
        });
    }
};

```

모달은 올바르게 표시되지만, 어떤 커스텀 게시물 메뉴 버튼이 클릭되었는지에 따라 post-id와 user를 어떻게 전달할 수 있는지 궁금합니다. GitHub에서 몇 시간째 검색해 보고 있지만, 이 값들을 커스텀 모달 컨트롤러로 전달하는 방법을 여전히 이해하지 못하고 있습니다.
