Skip to content

Commit 288ff65

Browse files
fetch global branding when org branding isn't available
1 parent 54925ea commit 288ff65

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

client/packages/lowcoder/src/api/enterpriseApi.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import axios from 'axios';
22

33
export interface FetchBrandingSettingPayload {
44
orgId?: string;
5+
fallbackToGlobal?: boolean;
56
}
67
export interface BrandingSettings {
78
logo?: string | null;

client/packages/lowcoder/src/app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ const mapDispatchToProps = (dispatch: any) => ({
459459
fetchHomeData: (currentUserAnonymous: boolean | undefined) => {
460460
dispatch(fetchHomeData({}));
461461
},
462-
fetchBrandingSetting: (orgId?: string) => dispatch(fetchBrandingSetting({ orgId })),
462+
fetchBrandingSetting: (orgId?: string) => dispatch(fetchBrandingSetting({ orgId, fallbackToGlobal: true })),
463463
fetchLowcoderCompVersions: async () => {
464464
try {
465465
dispatch(setLowcoderCompsLoading(true));

client/packages/lowcoder/src/pages/userAuth/formLoginSteps.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ export default function FormLoginSteps(props: FormLoginProps) {
184184
// and skip workspace selection step
185185
if (Boolean(organizationId)) {
186186
setSkipWorkspaceStep(true);
187-
dispatch(fetchConfigAction(organizationId));
188187
setCurrentStep(CurrentStepEnum.AUTH_PROVIDERS);
189188
return;
190189
}
@@ -226,7 +225,6 @@ export default function FormLoginSteps(props: FormLoginProps) {
226225

227226
useEffect(() => {
228227
if (isEnterpriseMode) {
229-
// dispatch(fetchConfigAction());
230228
fetchOrgsByEmail();
231229
}
232230
}, [isEnterpriseMode]);

client/packages/lowcoder/src/pages/userAuth/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default function UserAuth() {
3030
useEffect(() => {
3131
if(organizationId) {
3232
dispatch(fetchConfigAction(organizationId));
33-
dispatch(fetchBrandingSetting({orgId: organizationId}));
33+
dispatch(fetchBrandingSetting({orgId: organizationId, fallbackToGlobal: true}));
3434
} else {
3535
dispatch(fetchBrandingSetting({orgId: ''}));
3636
}

client/packages/lowcoder/src/redux/sagas/enterpriseSagas.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ function* fetchBrandingSettingSaga(action: ReduxAction<FetchBrandingSettingPaylo
3232
}
3333
} catch (error) {
3434
console.error('Failed to fetch branding setting:', error);
35+
// fetch global branding if org's branding setting is not available
36+
if (Boolean(action.payload.orgId) && action.payload.fallbackToGlobal) {
37+
yield put({
38+
type: ReduxActionTypes.FETCH_BRANDING_SETTING,
39+
payload: {},
40+
})
41+
}
3542
}
3643
}
3744

0 commit comments

Comments
 (0)