Skip to content

Commit

Permalink
test: fcm app test
Browse files Browse the repository at this point in the history
  • Loading branch information
eun-hak committed Jun 3, 2024
1 parent b12e0b6 commit e4d79ed
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions src/pages/mypage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,26 @@ const MyPage = () => {
<div
className="w-[361px] h-9 pb-3 flex justify-start items-center gap-[268px] cursor-pointer"
onClick={() => {
Notification.requestPermission().then((permission) => {
if (permission !== 'granted') {
// 푸시 거부됐을 때 처리할 내용
console.log('푸시 거부됨');
} else {
// 푸시 승인됐을 때 처리할 내용
console.log('푸시 승인됨');
}
});
if (Notification.permission === 'default') {
Notification.requestPermission().then((permission) => {
if (permission === 'granted') {
console.log('푸시 승인됨');
// 승인된 후 처리할 내용
} else if (permission === 'denied') {
console.log('푸시 거부됨');
alert(
'알림 권한이 거부되었습니다. 설정에서 알림 권한을 변경해 주세요.'
);
}
});
} else if (Notification.permission === 'denied') {
alert(
'알림 권한이 거부되었습니다. 브라우저 설정에서 알림 권한을 변경해 주세요.'
);
} else {
console.log('푸시 승인됨');
// 이미 승인된 경우 처리할 내용
}
}}>
<div className="h-6 flex justify-start items-start gap-3.5">
<div className="w-[360px] flex justify-between">
Expand Down

0 comments on commit e4d79ed

Please sign in to comment.