# 게이트된 콘텐츠에서 사용자 리다이렉트 방법

**URL:** https://meta.discourse.org/t/help-on-redirect-user-on-gated-content/264351
**Category:** Development
**Created:** [5월 9, 2023, 4:40오전 UTC](https://meta.discourse.org/t/help-on-redirect-user-on-gated-content/264351 "2023-05-09T04:40:37Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![th21](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/th21/32/211915_2.png) [@th21](https://meta.discourse.org/u/th21)
#### Post date: [5월 9, 2023, 4:40오전 UTC](https://meta.discourse.org/t/help-on-redirect-user-on-gated-content/264351/1 "2023-05-09T04:40:37Z")

</div>

[Gated Topics in Category](https://meta.discourse.org/t/gated-topics-in-category/225454)에서 이어서 논의합니다:

게이트(gate)를 표시하는 대신 사용자가 특정 페이지로 리다이렉트되도록 게이트드 컴포넌트를 수정하려고 했습니다.

1  
테마 크리에이터에서 `DiscourseURL.routeTo('/t/table-builder-test-2/1667')`를 시도해 보았지만, 동작은 합니다. 다만 시간이 좀 걸리고 로딩 시 오류가 발생하며, 페이지는 정상적으로 로드됩니다.

 ![image](https://global.discourse-cdn.com/meta/original/4X/2/8/b/28bd5b8bb09e2e6ba346df7384d28b74b4443199.jpeg)

2  
`setDefaultHomepage('/t/table-builder-test-2/1667');`와

```plaintext
      const container = Discourse. __container__ ;
      const router = container.lookup("router:main");

      let topicId = router.currentRoute.parent.params.id

      PreloadStore.remove(`topic/${topicId}`);

```

을 함께 시도해 보았지만, 게이트드 페이지가 로드된 후 뒤로 가기 버튼을 누를 때만 리다이렉트가 이루어집니다.

3  
`location.href = '/t/table-builder-test-2/1667'`

동작은 하지만, 1번과 달리 부드럽지 않고 게이트드 페이지가 몇 초간 로드됩니다.

이 목표를 달성하는 가장 좋은 방법은 무엇일까요?

---

<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: [5월 9, 2023, 9:53오후 UTC](https://meta.discourse.org/t/help-on-redirect-user-on-gated-content/264351/2 "2023-05-09T21:53:17Z")

</div>

저의 [커스텀 홈페이지](https://meta.discourse.org/t/custom-homepage/199623) 테마는 홈페이지를 변경합니다. 핵심은 일부 콘텐츠가 미리 로드되므로 이를 제거하기 위해 특정 작업을 수행해야 한다는 점입니다.

휴대폰에서 설명하는 데 한계가 있어, 코드의 예시를 찾아보실 수 있기를 바랍니다. 🤷

---

<div class="post-metadata">

### Author: ![th21](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/th21/32/211915_2.png) [@th21](https://meta.discourse.org/u/th21)
#### Post date: [5월 13, 2023, 5:33오후 UTC](https://meta.discourse.org/t/help-on-redirect-user-on-gated-content/264351/3 "2023-05-13T17:33:34Z")

</div>

다음 코드로 시도해 보았지만

```plaintext
let topicId = router.currentRoute.parent.params.id
PreloadStore.remove(`topic/${topicId}`);

```

동작하지 않습니다. PreloadStore.remove 메서드의 작동 방식에 대한 문서가 있을까요?
