()
| 50 | }, [profile, profiles]); |
| 51 | |
| 52 | const handleRefresh = async () => { |
| 53 | if (!currentProfile?.id) { |
| 54 | showNotification({ |
| 55 | title: 'Error', |
| 56 | message: 'Unable to refresh: Profile information not available', |
| 57 | color: 'red', |
| 58 | icon: <XCircle size={16} />, |
| 59 | }); |
| 60 | return; |
| 61 | } |
| 62 | |
| 63 | setIsRefreshing(true); |
| 64 | |
| 65 | try { |
| 66 | const data = await refreshAccountInfo(currentProfile); |
| 67 | |
| 68 | if (data.success) { |
| 69 | showNotification({ |
| 70 | title: 'Success', |
| 71 | message: |
| 72 | 'Account info refresh initiated. The information will be updated shortly.', |
| 73 | color: 'green', |
| 74 | icon: <CheckCircle size={16} />, |
| 75 | }); |
| 76 | |
| 77 | // Call the parent's refresh function if provided |
| 78 | if (onRefresh) { |
| 79 | // Wait a moment for the backend to process, then refresh |
| 80 | setTimeout(onRefresh, 2000); |
| 81 | } |
| 82 | } else { |
| 83 | showNotification({ |
| 84 | title: 'Error', |
| 85 | message: data.error || 'Failed to refresh account information', |
| 86 | color: 'red', |
| 87 | icon: <XCircle size={16} />, |
| 88 | }); |
| 89 | } |
| 90 | } catch { |
| 91 | // Error notification is already handled by the API function |
| 92 | // Just need to handle the UI state |
| 93 | } finally { |
| 94 | setIsRefreshing(false); |
| 95 | } |
| 96 | }; |
| 97 | |
| 98 | if (!currentProfile || !currentProfile.custom_properties) { |
| 99 | return ( |
nothing calls this directly
no test coverage detected