fonctionnalité majeure : setup ultra simplifié (installation/configuration des infos supabase directement du web)
This commit is contained in:
@@ -22,6 +22,7 @@ export const dynamic = 'force-dynamic';
|
||||
function AdminPageContent() {
|
||||
const [campaigns, setCampaigns] = useState<CampaignWithStats[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [checkingConfig, setCheckingConfig] = useState(true);
|
||||
const [showCreateModal, setShowCreateModal] = useState(false);
|
||||
const [showEditModal, setShowEditModal] = useState(false);
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||
@@ -30,6 +31,20 @@ function AdminPageContent() {
|
||||
const [copiedCampaignId, setCopiedCampaignId] = useState<string | null>(null);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
setCheckingConfig(false);
|
||||
loadCampaigns();
|
||||
}, []);
|
||||
|
||||
@@ -124,9 +139,21 @@ function AdminPageContent() {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// Affichage de chargement pendant la vérification de configuration
|
||||
if (checkingConfig) {
|
||||
return (
|
||||
<div className="min-h-screen bg-slate-50 dark:bg-slate-900">
|
||||
<div className="container mx-auto px-4 py-8">
|
||||
<div className="flex items-center justify-center h-64">
|
||||
<div className="text-center">
|
||||
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-slate-900 dark:border-slate-100 mx-auto mb-4"></div>
|
||||
<p className="text-slate-600 dark:text-slate-300">Vérification de la configuration...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
@@ -192,6 +219,7 @@ function AdminPageContent() {
|
||||
Paramètres
|
||||
</Link>
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
variant="outline"
|
||||
size="lg"
|
||||
|
||||
Reference in New Issue
Block a user