Add debug logging for logo/favicon upload state
- Add console.log to track URL generation - Use functional setState to avoid stale closure issues - Log settings state before save This will help diagnose why URLs are empty in save payload 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -101,6 +101,7 @@ export function BrandingTab() {
|
|||||||
|
|
||||||
const saveSettings = async () => {
|
const saveSettings = async () => {
|
||||||
setSaving(true);
|
setSaving(true);
|
||||||
|
console.log('Current settings before save:', settings);
|
||||||
const payload = {
|
const payload = {
|
||||||
brand_name: settings.brand_name,
|
brand_name: settings.brand_name,
|
||||||
brand_tagline: settings.brand_tagline,
|
brand_tagline: settings.brand_tagline,
|
||||||
@@ -112,6 +113,7 @@ export function BrandingTab() {
|
|||||||
homepage_description: settings.homepage_description,
|
homepage_description: settings.homepage_description,
|
||||||
homepage_features: settings.homepage_features,
|
homepage_features: settings.homepage_features,
|
||||||
};
|
};
|
||||||
|
console.log('Saving payload:', payload);
|
||||||
|
|
||||||
if (settings.id) {
|
if (settings.id) {
|
||||||
const { error } = await supabase
|
const { error } = await supabase
|
||||||
@@ -190,7 +192,9 @@ export function BrandingTab() {
|
|||||||
|
|
||||||
// Step 3: Get public URL and update settings
|
// Step 3: Get public URL and update settings
|
||||||
const { data: urlData } = supabase.storage.from('content').getPublicUrl(filePath);
|
const { data: urlData } = supabase.storage.from('content').getPublicUrl(filePath);
|
||||||
setSettings({ ...settings, brand_logo_url: urlData.publicUrl });
|
console.log('Logo upload successful:', urlData.publicUrl);
|
||||||
|
setSettings(prev => ({ ...prev, brand_logo_url: urlData.publicUrl }));
|
||||||
|
console.log('State updated with logo URL');
|
||||||
|
|
||||||
toast({ title: 'Berhasil', description: 'Logo berhasil diupload' });
|
toast({ title: 'Berhasil', description: 'Logo berhasil diupload' });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -232,7 +236,9 @@ export function BrandingTab() {
|
|||||||
|
|
||||||
// Step 3: Get public URL and update settings
|
// Step 3: Get public URL and update settings
|
||||||
const { data: urlData } = supabase.storage.from('content').getPublicUrl(filePath);
|
const { data: urlData } = supabase.storage.from('content').getPublicUrl(filePath);
|
||||||
setSettings({ ...settings, brand_favicon_url: urlData.publicUrl });
|
console.log('Favicon upload successful:', urlData.publicUrl);
|
||||||
|
setSettings(prev => ({ ...prev, brand_favicon_url: urlData.publicUrl }));
|
||||||
|
console.log('State updated with favicon URL');
|
||||||
|
|
||||||
toast({ title: 'Berhasil', description: 'Favicon berhasil diupload' });
|
toast({ title: 'Berhasil', description: 'Favicon berhasil diupload' });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user