This commit is contained in:
Iliyan Angelov
2025-12-10 01:36:00 +02:00
parent 2f6dca736a
commit 6a9e823402
84 changed files with 5293 additions and 1836 deletions

View File

@@ -63,13 +63,23 @@ export const usePolicy = (type: 'privacy' | 'terms' | 'support' | null): UsePoli
return;
}
// Don't fetch on server side
if (typeof window === 'undefined') {
setIsLoading(false);
return;
}
try {
setIsLoading(true);
setError(null);
const result = await getPolicyByType(type);
setData(result);
} catch (err) {
setError(err instanceof Error ? err : new Error('An error occurred'));
const errorMessage = err instanceof Error ? err.message : 'An error occurred while loading the policy';
console.error('Policy fetch error:', err);
setError(new Error(errorMessage));
// Set data to null on error to prevent rendering issues
setData(null);
} finally {
setIsLoading(false);
}