Skip to content

Commit

Permalink
chore: 알림 안오면 강제 리로드
Browse files Browse the repository at this point in the history
  • Loading branch information
clean2001 committed Sep 5, 2024
1 parent a9bb7c4 commit 4a8d547
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/header/HeaderComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,13 @@ import MyAlert from '@/views/member/MyAlert.vue';
const token = localStorage.getItem("token");
// axios 요청이 아니라서 토큰을 따로 세팅해 주어야 한다.
let sse = new EventSourcePolyfill(`${process.env.VUE_APP_API_BASE_URL}/sse/subscribe`, {headers: {Authorization: `Bearer ${token}`}});
let sse;
try {
sse = new EventSourcePolyfill(`${process.env.VUE_APP_API_BASE_URL}/sse/subscribe`, {headers: {Authorization: `Bearer ${token}`}});
} catch(e) {
window.location.reload();
}
sse.addEventListener('connect', (event) => {
console.log(event);
}); // connect라는 이름의 이벤트가 들어오면
Expand Down

0 comments on commit 4a8d547

Please sign in to comment.