Refactor API permissions and throttling: Updated default permission classes to enforce authentication and tenant access. Introduced new permission for system accounts and developers. Enhanced throttling rates for various operations to reduce false 429 errors. Improved API key loading logic to prioritize account-specific settings, with fallbacks to system accounts and Django settings. Updated integration views and sidebar to reflect new permission structure.

This commit is contained in:
IGNY8 VPS (Salman)
2025-12-07 17:23:42 +00:00
parent 3cbed65601
commit 65fea95d33
15 changed files with 374 additions and 71 deletions

View File

@@ -49,7 +49,7 @@ export default function WorkflowGuide({ onSiteAdded }: WorkflowGuideProps) {
const [siteName, setSiteName] = useState('');
const [websiteAddress, setWebsiteAddress] = useState('');
// Load dismissal state from backend on mount
// Load dismissal state from backend on mount (guarded in store)
useEffect(() => {
if (isAuthenticated) {
loadFromBackend().catch(() => {
@@ -67,8 +67,11 @@ export default function WorkflowGuide({ onSiteAdded }: WorkflowGuideProps) {
setLoadingIndustries(true);
const response = await fetchIndustries();
setIndustries(response.industries || []);
} catch (error) {
console.error('Failed to load industries:', error);
} catch (error: any) {
// Swallow 429 to avoid noisy console; user can retry via toggle
if (error?.status !== 429) {
console.error('Failed to load industries:', error);
}
} finally {
setLoadingIndustries(false);
}
@@ -108,8 +111,10 @@ export default function WorkflowGuide({ onSiteAdded }: WorkflowGuideProps) {
setLoadingIndustries(true);
const response = await fetchIndustries();
setIndustries(response.industries || []);
} catch (error) {
console.error('Failed to load industries:', error);
} catch (error: any) {
if (error?.status !== 429) {
console.error('Failed to load industries:', error);
}
} finally {
setLoadingIndustries(false);
}