fix(admin,frontend): fix hydration mismatch, admin UI texts sync, and product image resolution
Deploy Canina / deploy (push) Failing after 1s
Deploy Canina / deploy (push) Failing after 1s
This commit is contained in:
1 parent
3122c5b13f
commit
5ec99155c4
7 files changed
+103
-31
No files matched your search
@@ -99,7 +99,19 @@ export default function UITexts() {
|
||||
useEffect(() => {
|
||||
let isSubscribed = true;
|
||||
api.get('/settings/ui-texts').then(res => {
|
||||
if (isSubscribed) setTexts(res.data || {});
|
||||
if (isSubscribed) {
|
||||
const textsObj: Record<string, string> = {};
|
||||
if (Array.isArray(res.data)) {
|
||||
res.data.forEach((item: { key?: string; value?: string }) => {
|
||||
if (item && item.key) {
|
||||
textsObj[item.key] = typeof item.value === 'string' ? item.value : (item.value ? JSON.stringify(item.value) : '');
|
||||
}
|
||||
});
|
||||
} else if (typeof res.data === 'object' && res.data !== null) {
|
||||
Object.assign(textsObj, res.data);
|
||||
}
|
||||
setTexts(textsObj);
|
||||
}
|
||||
}).catch(e => {
|
||||
console.error('Failed to load UI texts:', e);
|
||||
}).finally(() => {
|
||||
|
||||
Reference in new issue
Block a user