fonctionnalité majeure : setup ultra simplifié (installation/configuration des infos supabase directement du web)
This commit is contained in:
@@ -74,6 +74,19 @@ function CampaignStatsPageContent() {
|
||||
const [sortBy, setSortBy] = useState<SortOption>('total_impact');
|
||||
|
||||
useEffect(() => {
|
||||
// Vérifier la configuration Supabase
|
||||
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
|
||||
const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
|
||||
|
||||
// Si pas de configuration ou valeurs par défaut, rediriger vers setup
|
||||
if (!supabaseUrl || !supabaseAnonKey ||
|
||||
supabaseUrl === 'https://placeholder.supabase.co' ||
|
||||
supabaseAnonKey === 'your-anon-key') {
|
||||
console.log('🔧 Configuration Supabase manquante, redirection vers /setup');
|
||||
window.location.href = '/setup';
|
||||
return;
|
||||
}
|
||||
|
||||
if (campaignId) {
|
||||
loadData();
|
||||
}
|
||||
@@ -82,14 +95,13 @@ function CampaignStatsPageContent() {
|
||||
const loadData = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const [campaigns, participantsData, propositionsData, votesData] = await Promise.all([
|
||||
campaignService.getAll(),
|
||||
const [campaignData, participantsData, propositionsData, votesData] = await Promise.all([
|
||||
campaignService.getById(campaignId),
|
||||
participantService.getByCampaign(campaignId),
|
||||
propositionService.getByCampaign(campaignId),
|
||||
voteService.getByCampaign(campaignId)
|
||||
]);
|
||||
|
||||
const campaignData = campaigns.find(c => c.id === campaignId);
|
||||
if (!campaignData) {
|
||||
throw new Error('Campagne non trouvée');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user