File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments