Skip to content

Commit e319355

Browse files
Merge pull request #498 from meowzip/hyoni
Fix: 푸시 알림 권한 api refetch 추가
2 parents 4846238 + 8fd6a92 commit e319355

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/app/profile/setting/page.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ const SettingPage = () => {
3535
data: pushPermission,
3636
isSuccess,
3737
isError,
38-
error
38+
error,
39+
refetch
3940
} = useQuery({
4041
queryKey: ['getPushNoti'],
4142
queryFn: () => getPushNotification(),
@@ -47,22 +48,23 @@ const SettingPage = () => {
4748
mutationFn: () => togglePushNotificationOnServer(),
4849
onSuccess: (data: any) => {
4950
if (data.status === 'OK') {
50-
queryClient.invalidateQueries({
51-
predicate: query => query.queryKey[0] === 'getPushNoti'
52-
});
51+
// queryClient.invalidateQueries({
52+
// predicate: query => query.queryKey[0] === 'getPushNoti'
53+
// });
54+
refetch();
5355
}
5456
}
5557
});
5658
useEffect(() => {
57-
if (isSuccess && pushPermission) {
59+
if (isSuccess) {
5860
const currentEnabled: Boolean = pushPermission.receivePushNotification;
5961
const shouldBeEnabled: Boolean = permission;
60-
console.log('🍋🍋 currentEnabled: ', currentEnabled);
61-
console.log('🍋🍋🍋 shouldBeEnabled: ', shouldBeEnabled);
6262

6363
if (shouldBeEnabled === currentEnabled) return;
6464

6565
toggleSwitch();
66+
console.log('🍋🍋 currentEnabled: ', currentEnabled);
67+
console.log('🍋🍋🍋 shouldBeEnabled: ', shouldBeEnabled);
6668
}
6769
}, [permission]);
6870

0 commit comments

Comments
 (0)