From f8dd68226c01fa5f5db6ead7806ae4d49bcf9d51 Mon Sep 17 00:00:00 2001 From: mpetrov Date: Thu, 16 Jan 2025 12:01:07 +0200 Subject: [PATCH] resolved comments --- ui-ngx/src/app/core/http/domain.service.ts | 2 +- .../pages/admin/oauth2/domains/domain-table-config.resolver.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/core/http/domain.service.ts b/ui-ngx/src/app/core/http/domain.service.ts index f20e30d1b1..fe05305c6f 100644 --- a/ui-ngx/src/app/core/http/domain.service.ts +++ b/ui-ngx/src/app/core/http/domain.service.ts @@ -32,7 +32,7 @@ export class DomainService { ) { } - public saveDomain(domain: Domain, oauth2ClientIds: Array, config?: RequestConfig): Observable { + public saveDomain(domain: Domain, oauth2ClientIds?: Array, config?: RequestConfig): Observable { let url = '/api/domain'; if (oauth2ClientIds?.length) { url += `?oauth2ClientIds=${oauth2ClientIds.join(',')}`; diff --git a/ui-ngx/src/app/modules/home/pages/admin/oauth2/domains/domain-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/admin/oauth2/domains/domain-table-config.resolver.ts index 95a260f9ba..4f0603545f 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/oauth2/domains/domain-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/admin/oauth2/domains/domain-table-config.resolver.ts @@ -85,11 +85,12 @@ export class DomainTableConfigResolver { this.config.loadEntity = id => this.domainService.getDomainInfoById(id.id); this.config.saveEntity = (domain, originalDomain) => { const clientsIds = domain.oauth2ClientInfos as Array || []; + const newDomainClients = domain.oauth2ClientInfos; delete domain.oauth2ClientInfos; return this.domainService.saveDomain(domain, domain.id ? [] : clientsIds).pipe( switchMap(savedDomain => { - const shouldUpdateClients = domain.id && !isEqual(domain.oauth2ClientInfos?.sort(), + const shouldUpdateClients = domain.id && !isEqual(newDomainClients?.sort(), originalDomain.oauth2ClientInfos?.map(info => info.id ? info.id.id : info).sort()); return shouldUpdateClients ? this.domainService.updateOauth2Clients(domain.id.id, clientsIds).pipe(map(() => savedDomain))