fix: DB values override env vars in campaign settings, Settings page resets on campaign switch
All checks were successful
Build and Push / build (push) Successful in 12m16s
All checks were successful
Build and Push / build (push) Successful in 12m16s
This commit is contained in:
@@ -6,15 +6,18 @@ export default function Settings() {
|
||||
const { currentCampaign } = useCampaign();
|
||||
const [settings, setSettings] = useState<any>(null);
|
||||
const [saved, setSaved] = useState(false);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const campaignId = currentCampaign?.id;
|
||||
|
||||
useEffect(() => {
|
||||
if (!campaignId) return;
|
||||
api.getCampaignSettings(campaignId).then(setSettings);
|
||||
setSettings(null);
|
||||
setLoading(true);
|
||||
api.getCampaignSettings(campaignId).then(s => { setSettings(s); setLoading(false); });
|
||||
}, [campaignId]);
|
||||
|
||||
if (!settings || !campaignId) return null;
|
||||
if (!settings || !campaignId) return loading ? <div className="max-w-4xl mx-auto py-16 px-4"><p className="text-ink/40">Loading...</p></div> : null;
|
||||
|
||||
const set = (k: string, v: any) => setSettings({ ...settings, [k]: v });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user