Skip to content

Commit

Permalink
Fixed tenants logos
Browse files Browse the repository at this point in the history
  • Loading branch information
AlixH committed Dec 8, 2021
1 parent 964eeca commit a138662
Showing 2 changed files with 11 additions and 14 deletions.
14 changes: 5 additions & 9 deletions src/provider/CentralServerProvider.tsx
Original file line number Diff line number Diff line change
@@ -152,7 +152,7 @@ export default class CentralServerProvider {
let tenantLogo = this.tenantLogosCache.get(tenant.subdomain);
if (!tenantLogo) {
// Call backend
const result = await this.axiosInstance.get(this.buildUtilRestEndpointUrl(ServerRoute.REST_TENANT_LOGO), {
const result = await this.axiosInstance.get(this.buildUtilRestEndpointUrl(ServerRoute.REST_TENANT_LOGO, null, tenant), {
headers: this.buildHeaders(),
responseType: 'arraybuffer',
params: {
@@ -1070,12 +1070,8 @@ export default class CentralServerProvider {
return this.tenant?.endpoint + '/v1/api';
}

private buildUtilRestServerURL(): string {
return this.tenant?.endpoint + '/v1/util';
}

private buildCentralRestServerServiceUtilURL(tenant: TenantConnection): string {
return tenant?.endpoint + '/client/util';
private buildUtilRestServerURL(tenant?: TenantConnection): string {
return (tenant?.endpoint ?? this.tenant?.endpoint) + '/v1/util';
}

private buildCentralRestServerServiceSecuredURL(): string {
@@ -1092,7 +1088,7 @@ export default class CentralServerProvider {
return `${urlPrefix}/${resolvedUrlPattern}`;
}

public buildUtilRestEndpointUrl(urlPatternAsString: ServerRoute, params: { [name: string]: string | number | null } = {}): string {
return this.buildRestEndpointUrl(urlPatternAsString, params, this.buildUtilRestServerURL());
public buildUtilRestEndpointUrl(urlPatternAsString: ServerRoute, params: { [name: string]: string | number | null } = {}, tenant?: TenantConnection): string {
return this.buildRestEndpointUrl(urlPatternAsString, params, this.buildUtilRestServerURL(tenant));
}
}
11 changes: 6 additions & 5 deletions src/screens/auth/login/Login.tsx
Original file line number Diff line number Diff line change
@@ -172,6 +172,7 @@ export default class Login extends BaseScreen<Props, State> {
this.tenants = await this.centralServerProvider.getTenants();
this.setState({
tenantSubDomain: null,
tenantLogo: null,
tenantName: I18n.t('authentication.tenant'),
email: null,
password: null
@@ -286,17 +287,17 @@ export default class Login extends BaseScreen<Props, State> {
this.setState({
email: credentials.email,
password: credentials.password,
tenantSubDomain: tenant.subdomain,
tenantName: tenant.name,
tenantSubDomain: tenant?.subdomain,
tenantName: tenant?.name,
tenantLogo
});
} else {
// Set Tenant
this.setState({
email: null,
password: null,
tenantSubDomain: tenant.subdomain,
tenantName: tenant.name,
tenantSubDomain: tenant?.subdomain,
tenantName: tenant?.name,
tenantLogo
});
}
@@ -368,7 +369,7 @@ export default class Login extends BaseScreen<Props, State> {
<Form style={formStyle.form}>
<Button block style={formStyle.button} onPress={() => this.goToTenants()}>
<Text style={formStyle.buttonText} uppercase={false}>
{this.state.tenantName}
{this.state?.tenantName}
</Text>
</Button>
{this.state.errorTenantSubDomain &&

0 comments on commit a138662

Please sign in to comment.