Enhance billing and subscription management: Added payment method checks in ProtectedRoute, improved error handling in billing components, and optimized API calls to reduce throttling. Updated user account handling in various components to ensure accurate plan and subscription data display.
This commit is contained in:
@@ -43,6 +43,7 @@ import {
|
||||
fetchAPI,
|
||||
} from '../../services/api';
|
||||
import { useToast } from '../../components/ui/toast/ToastContainer';
|
||||
import { isUpgradeError, showUpgradeToast } from '../../utils/upgrade';
|
||||
import SiteTypeBadge from '../../components/sites/SiteTypeBadge';
|
||||
|
||||
interface Site extends SiteType {
|
||||
@@ -131,7 +132,11 @@ export default function SiteList() {
|
||||
setSites(sitesWithIntegrations);
|
||||
}
|
||||
} catch (error: any) {
|
||||
toast.error(`Failed to load sites: ${error.message}`);
|
||||
if (isUpgradeError(error)) {
|
||||
showUpgradeToast(toast);
|
||||
} else {
|
||||
toast.error(`Failed to load sites: ${error.message}`);
|
||||
}
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -240,7 +245,11 @@ export default function SiteList() {
|
||||
toast.success('Site deleted successfully');
|
||||
await loadSites();
|
||||
} catch (error: any) {
|
||||
toast.error(`Failed to delete site: ${error.message}`);
|
||||
if (isUpgradeError(error)) {
|
||||
showUpgradeToast(toast);
|
||||
} else {
|
||||
toast.error(`Failed to delete site: ${error.message}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user