Skip to content

Commit

Permalink
Merge pull request #196 from lotteon2/fix/manage-in-where-to-start-ss…
Browse files Browse the repository at this point in the history
…e-subscribe

[FIX] order-success 팝업에서 Headercomponent OnMounted 훅 제어 위해 App.vue 수정
  • Loading branch information
CessnaJ authored Jan 16, 2024
2 parents 0e941fb + 660f63d commit 46befd8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<script setup lang='ts'>
import { RouterView } from 'vue-router'
import { provide, ref } from 'vue'
<script setup lang="ts">
import { RouterView, useRoute } from 'vue-router'
import { provide, ref, computed } from 'vue'
import HeaderComponent from '@/components/HeaderComponent.vue'
import FooterComponent from '@/components/FooterComponent.vue'
import { debounce } from 'lodash'
let isScrollEnd = ref<boolean>(false)
const route = useRoute()
const displayHeader = computed(() => !route.path.startsWith('/order-success'))
const onScroll = debounce(async (event: any) => {
const { scrollHeight, scrollTop, clientHeight } = event.target
Expand All @@ -19,11 +21,11 @@ provide('isScrollEnd', isScrollEnd)
</script>

<template>
<div class='container' @scroll='onScroll'>
<div class="container" @scroll="onScroll">
<header>
<HeaderComponent />
<HeaderComponent v-if="displayHeader" />
</header>
<main class='main'>
<main class="main">
<RouterView />
</main>
<footer>
Expand Down
2 changes: 1 addition & 1 deletion src/apis/notification/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export const subscribeToNotifications = (

return () => {
// console.log('SSE connection을 해제합니다.')
eventSource.close()
eventSource.close() // eventSourceUnsubscribe를 구독상태에서 호출하면 close함.
console.log('SSE connection이 해제되었습니다.')
}
}

0 comments on commit 46befd8

Please sign in to comment.